Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i initialize the new version of crashlytics?

Everything works fine when I initialize my application with:

Fabric.with(this, new Crashlytics());

However, I get an exception when I use:

Fabric.with(this, new CrashlyticsCore());

The following exception:

FATAL EXCEPTION: main Process: com.weightbook, PID: 19438
java.lang.IllegalStateException: Crashlytics must be initialized by calling Fabric.with(Context) prior to calling Crashlytics.getInstance()
at com.crashlytics.android.Crashlytics.checkInitialized(Crashlytics.java:372)
at com.crashlytics.android.Crashlytics.setUserName(Crashlytics.java:248)
at com.weightbook.analytics.AnalyticsManager.setUsernameOnCrashlytics(AnalyticsManager.java:64)
like image 447
Kamilski81 Avatar asked Dec 14 '15 22:12

Kamilski81


1 Answers

Mike from Fabric and Crashlytics here. Your first init call is correct, but you could also use:

Fabric.with(this, new CrashlyticsCore(), new Crashlytics());

or use:

Fabric.with(this, CrashlyticsCore.getInstance());

with the following imports:

import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import io.fabric.sdk.android.Fabric;

Using just CrashlyticsCore.getInstance() will give you only Crashlytics crash reporting and nothing else, where as new Crashlytics() would include Beta and Answers.

like image 54
Mike Bonnell Avatar answered Sep 19 '22 10:09

Mike Bonnell