twitter-kit-android icon indicating copy to clipboard operation
twitter-kit-android copied to clipboard

IllegalStateException in OAuthActivity

Open stephanedupont opened this issue 6 years ago • 7 comments

Hi there,

I’m using the Twitter Kit for Android to enable users to signin via Twitter in an app. It works fine and all the testing I have done are good, works as a charm.

But I have some crash report in Crashlytics:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.[apppackagename]/com.twitter.sdk.android.core.identity.OAuthActivity}: java.lang.IllegalStateException: Must initialize Twitter before using getInstance() at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) [...]

I did a quick search and:

In the fragment where I allow users to sign in, I use this:

TwitterConfig config = new TwitterConfig.Builder(activity.getApplicationContext()) .logger(new DefaultLogger(Log.DEBUG)) .twitterAuthConfig(new TwitterAuthConfig("...", "...")) .debug(true) .build(); Twitter.initialize(config);

twitterAuthClient = new TwitterAuthClient();

(and so as you can see I call initialize before doing anything with the twitter auth client)

The crash is happening in the twitter-core-3.1.1 OAuthActivity class. And indeed, it seems that there’s no call to Twitter.initialize() here.

Is this a known issue?

Thank you, Stéphane.

stephanedupont avatar Feb 04 '18 21:02 stephanedupont

So basically this SDK is not maintained?

stephanedupont avatar Mar 02 '18 17:03 stephanedupont

Pretty much friend, good luck.

Ha-So avatar Aug 13 '18 00:08 Ha-So

Is this problem still not solved?

momo88xiaowu avatar Aug 24 '18 06:08 momo88xiaowu

https://stackoverflow.com/questions/46133959/twitter-log-in-button-greyed-out/46139656 try it~

momo88xiaowu avatar Aug 24 '18 06:08 momo88xiaowu

Thank you, but no, it's already the case in my code.

stephanedupont avatar Aug 24 '18 06:08 stephanedupont

Me too, com.twitter.sdk.android.core.identity.OAuthActivity}: java.lang.IllegalStateException: Must initialize Twitter before using getInstance().

using implementation 'com.twitter.sdk.android:twitter-core:3.1.1'

When open login wih Twitter, then go to another app, when return throws exception in my thread. Any solution?

xaxa10 avatar Sep 19 '18 17:09 xaxa10

We've been waiting for a fix for this for 2 years. We're now looking into alternatives to show Tweets in our app as this lib is outdated and not maintained.

c0dehunter avatar Apr 08 '19 12:04 c0dehunter