[FIXED] No package identifier when getting value for resource number 0x00000000

android

#1

Hi,

I’m trying to implement twitter login in my android app.
I’ve followed the instructions ( https://dev.twitter.com/twitter-kit/android/twitter-login ) but when I call Fabric.with(this, new Twitter(authConfig)); the following exception occur.

06-02 14:03:00.267    5623-5638/it.quepasa W/ResourceType﹕ No package identifier when getting value for resource number 0x00000000
06-02 14:03:00.323    5623-5638/it.quepasa E/Fabric﹕ Could not calculate hash for app icon.
android.content.res.Resources$NotFoundException: Resource ID #0x0
        at android.content.res.Resources.getValue(Resources.java:1033)
        at android.content.res.Resources.openRawResource(Resources.java:958)
        at android.content.res.Resources.openRawResource(Resources.java:940)
        at io.fabric.sdk.android.services.common.CommonUtils.getAppIconHashOrNull(CommonUtils.java:861)
        at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:97)
        at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
        at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
        at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
        at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:838)
06-02 14:03:00.331    5623-5638/it.quepasa W/ResourceType﹕ No package identifier when getting value for resource number 0x00000000
06-02 14:03:00.333    5623-5638/it.quepasa E/Fabric﹕ Could not calculate hash for app icon.
android.content.res.Resources$NotFoundException: Resource ID #0x0
        at android.content.res.Resources.getValue(Resources.java:1033)
        at android.content.res.Resources.openRawResource(Resources.java:958)
        at android.content.res.Resources.openRawResource(Resources.java:940)
        at  io.fabric.sdk.android.services.common.CommonUtils.getAppIconHashOrNull(CommonUtils.java:861)
        at io.fabric.sdk.android.services.settings.Settings.initialize(Settings.java:90)
        at io.fabric.sdk.android.Onboarding.retrieveSettingsData(Onboarding.java:123)
        at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:99)
        at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
        at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
        at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
        at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:838)

I’ve tried to redo all the process using fabric plugin for android studio but it just redo the steps that I did manually and the problem persists.

Another exception occur when I tap on the login button:

06-02 11:22:23.611  24124-24124/it.quepasa E/Twitter﹕ Failed to get request token
com.twitter.sdk.android.core.TwitterApiException: method POST must have a request body.
        at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:400)
        at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
        at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
        at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at retrofit.Platform$Android$2$1.run(Platform.java:142)
        at java.lang.Thread.run(Thread.java:838)
06-02 11:22:23.686  24124-24124/it.quepasa E/Twitter﹕ Authorization completed with an error
com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
        at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:78)
        at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:198)
        at com.twitter.sdk.android.core.Callback.failure(Callback.java:28)
        at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
        at android.os.Handler.handleCallback(Handler.java:800)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5370)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
        at dalvik.system.NativeStart.main(Native Method)

Here there is my code:

AndroidManifest.xml:

    <meta-data
        android:name="io.fabric.ApiKey"
        android:value="XXXXXXXX" />

MainActivity.java:

    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig), new Crashlytics()); //I've tried without crashlytics, same problem. Crashlytics works..

LoginActivity.java:


    loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_buttons);
    loginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            Log.d(TAG, "Success");
        }

        @Override
        public void failure(TwitterException exception) {
            Log.d(TAG, "Failure");
        }
    });

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    loginButton.onActivityResult(requestCode, resultCode, data);
}

Any idea? I’m loosing too much time on this :frowning:

Thank you!

EDIT

Note: I don’t have the twitter app installed.


#2

Anyone?


#3

Update:
I’ve installed the twitter app. Now I still get the first exception but when I click on the login button it seems to work.
Obviously it should work without the twitter app using a webview… I’m puzzled. Any idea?

As a test, I’ve created a new app and implemented the login button. In the new app it works without exceptions and without the twitter app isntalled.


#4

Ok, apparently those are two different problems.
I’ve managed to solve the first one.
In my AndroidManifest.xml i was missing the android:icon attribute under <application …>
The second problem, the one that say “Failed to get request token” is still unsolved.
I will open a second thread for that.


#5