0

So Twitter kit is now not par of Fabric and is now standalone component. I was not using Twitter kit before now I want to use so had to include its dependency. But after adding it, seems like Fabric initialisation is broken. I used to init Fabric like this

Fabric.with(this, new Crashlytics(), new TwitterCore(authConfig), new Digits.Builder().withTheme(R.style.CustomDigitsTheme).build());

But now Fabric can’t be initialised as TwitterCore class is now not extending from Kit. Basically Fabric’s with method signature is something like this with(Context context, Kit... kits) but since TwitterCore is not extending from Kit, with method won’t accept it. I tried removing TwitterCore from list of Kits passed in with method but got this exception

io.fabric.sdk.android.services.concurrency.UnmetDependencyException: Referenced Kit was null, does the kit exist?

What is the right way to init Fabric with Digits and Crashlytics now that Twitter Kit is not part of Fabric? Can someone provide snippet? It is not accepting TwitterCore as a Kit and I guess that is why exception is raised.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Apr444
  • 53
  • 1
  • 9

1 Answers1

0

Mike from Fabric here. Here's how I initialize Crashlytics and Digits in Swift and Obj-c. Please note that Digits is being replaced with Firebase Auth and will no longer work as of Sept 30th. You should migrate to Firebase Auth or another service, and ship before that

Java:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Fabric.with(this, new Crashlytics(), new Digits());
        setContentView(R.layout.activity_main);
    }
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    Fabric.with([Crashlytics.self, Digits.self])

    return true
}

Obj-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [Fabric with:@[[Crashlytics class], [Digits class]]];
    //[self logUser];

    return YES;
}
Mike Bonnell
  • 16,181
  • 3
  • 61
  • 77
  • `TwitterCore` is no longer required in Fabric init? – Apr444 Sep 12 '17 at 05:33
  • No, that hasn't been required for a while when using Digits, but the change was backwards compatible. – Mike Bonnell Sep 12 '17 at 16:04
  • I get this when I try to initialise Fabric without TwitterCore. `io.fabric.sdk.android.services.concurrency.UnmetDependencyException: Referenced Kit was null, does the kit exist?`. Works if I pass TwitterCore to it. Any idea? – Apr444 Sep 15 '17 at 09:02
  • What references do you have to Twitter Kit in your info.plist? – Mike Bonnell Sep 15 '17 at 19:46
  • Not sure i got the question. but here is my init code `Fabric.with(this, new Crashlytics(), new TwitterCore(authConfig), new Digits.Builder().withTheme(R.style.CustomDigitsTheme).build(), new TweetUi());`. If I remove TwitterCore from it. I get above exception. – Apr444 Sep 16 '17 at 05:00
  • Gotcha, are you passing in an API key prior to the Fabric init? – Mike Bonnell Sep 18 '17 at 16:01
  • I don't think i'm passing API key to anything before init. I create `authConfig` like this `TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET); `. which is passed to TwitterCore. and like I said before, If i don't pass TwitterCore as a Kit to Fabric init, I get that exception. It's weird. – Apr444 Sep 18 '17 at 17:27
  • Hmm, strange. My keys are in an info.plist instead of creating the AuthConfig, but I did pull Twitter via Fabric out of my test app. – Mike Bonnell Sep 18 '17 at 17:30