Fabric can't be initialised after adding Twitter Kit 3.1.0

200 views Asked by At

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.

1

There are 1 answers

8
Mike Bonnell On

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