Error: "Must start TwieetUi Kit in Fabric.with()" but I am

android

#1

I’m trying to get tweets from a user timeline (e.g. my own “kootsoop”) using the code here and here.

If I put this code into my Activity’s onCreate method:

TwitterAuthConfig authConfig = new TwitterAuthConfig(TwitterHelper.TWITTER_CONSUMER_KEY, TwitterHelper.TWITTER_CONSUMER_SECRET);
Fabric.with(this, new TwitterCore(authConfig), new TweetUi());
UserTimeline userTimeline = new UserTimeline.Builder().screenName("kootsoop").build();

I get an exception at the userTimeline assignment line:

 Caused by: java.lang.IllegalStateException: Must start TweetUi Kit in Fabric.with().
        at com.twitter.sdk.android.tweetui.TweetUi.checkInitialized(TweetUi.java:108)
        at com.twitter.sdk.android.tweetui.TweetUi.getInstance(TweetUi.java:55)
        at com.twitter.sdk.android.tweetui.UserTimeline$Builder.<init>(UserTimeline.java:123)

But line 2 in my code snippet is calling Fabric.with!

What am I doing wrong or missing? Any pointers appreciated!


#2

It looks like the problem is that there are two places in the app where Fabric.with is called. And mine is the second one. Centralizing the calls to Fabric.with() seems to have fixed my problem.


#3