0
在我的應用Twitter的整合引發以下非法參數異常java.lang.IllegalArgumentException異常:TwitterSession不能爲空
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig), new Crashlytics());
TwitterSession twitterSession = Twitter.getSessionManager().getActiveSession();
Intent intent = new ComposerActivity.Builder(MainActivity.this)
.session(twitterSession)
.darkTheme()
.createIntent();
startActivity(intent);
的logcat:
03-02 14:21:04.183 29087-29087/com.example.admin.twitterintegration E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.admin.twitterintegration, PID: 29087
java.lang.IllegalArgumentException: TwitterSession must not be null
at com.twitter.sdk.android.tweetcomposer.ComposerActivity$Builder.session(ComposerActivity.java:79)
at com.example.admin.twitterintegration.MainActivity$3.onClick(MainActivity.java:105)
at android.view.View.performClick(View.java:4640)
at android.view.View$PerformClick.run(View.java:19425)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
感謝您的幫助。
它拋出一個Twitter會話異常無關,與回調和登錄按鈕。如果我不正確引導我。 – prasanthMurugan
檢查更新答案 – sasikumar
我沒有使用默認的twitter按鈕和回調方法。我使用[doc鏈接](https://docs.fabric.io/android/twitter/compose-tweets.html)創建一個twitter會話但它會拋出上述異常 – prasanthMurugan