2015-06-02 59 views
2

我試圖在我的android應用中實現twitter登錄。 我按照說明(https://dev.twitter.com/twitter-kit/android/twitter-login),但是當我調用Fabric.with(這個,新的Twitter(authConfig));會發生以下異常。Twitter獲取資源編號0x00000000時沒有包標識符

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) 

我試着重做全部採用布料插件機器人工作室的過程,但它只是重做我手動做的步驟和問題仍然存在。

,當我登錄按鈕點擊另一個例外出現:

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) 

這裏有我的代碼:

的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); 
} 

任何想法?我失去這個:(

謝謝你太多時間

注:我沒有安裝Twitter的應用程序它應該在網頁視圖工作做

回答

5

發現了這個問題。 。第一個異常顯然有兩個不同的問題

在我的AndroidManifest.xml我缺少屬性的android:。圖標<application ...>

我希望這會幫助別人

相關問題