How to initialize Crashlytics in Fabric.io?

Since Crashlytics is now part of Fabric the initialization process has changed, but is still simple. Instead of using Crashlytics.start() you should now use, but in the Application creation:

public class App extends Application {

    ...

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
    }

    ...

}

For a more richer example, see how Cannonball canonical sample app is doing:

public class App extends Application {

    ...

    private TwitterAuthConfig authConfig;

    ...

    @Override
    public void onCreate() {
        super.onCreate();
        authConfig = new TwitterAuthConfig(BuildConfig.CONSUMER_KEY, BuildConfig.CONSUMER_SECRET);
        Fabric.with(this, new Crashlytics(), new Twitter(authConfig), new MoPub());
    }

    ...

}

This code is available at: https://github.com/twitterdev/cannonball-android/blob/master/app/src/main/java/io/fabric/samples/cannonball/App.java#L96-L98


In latest version init is done automatically by ContentProvider https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

 import com.google.firebase.crashlytics.FirebaseCrashlytics

// ...

// Explicit initialization of Crashlytics is no longer required.

// OPTIONAL: If crash reporting has been explicitly disabled previously, add:
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true)