6

Just a quick question about Crashlytics from Fabric.io:

To disable it in debug, should we still use:

 Crashlytics crashlytics = new Crashlytics.Builder().disabled(BuildConfig.DEBUG).build();
        Fabric.with(this, crashlytics);

Or does Fabric handle the debug/release difference and should we just use:

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

The disabled method is depricated and if you use the Fabric plugin in Android Studio, it always changes the crashlytics instance to new Crashlytics().

TomCB
  • 3,983
  • 9
  • 40
  • 66

3 Answers3

13

With the new 2.3.+ version you should use somenthing like this:

Fabric.with(this, new Crashlytics.Builder()
            .core(new CrashlyticsCore.Builder()
                    .disabled(BuildConfig.DEBUG)
                    .build())
            .build());
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
2

Try this.

Fabric.Builder.debuggable(boolean)

Java Doc API Crashlytics

setDebugMode(boolean debug) Deprecated. use Fabric.Builder.debuggable(boolean) instead

UPDATED

For more info visit SO - CrashLytics Deprecated

Community
  • 1
  • 1
Bharatesh
  • 8,943
  • 3
  • 38
  • 67
0

Another option would be to have a debug version of Application: https://www.littlerobots.nl/blog/stetho-for-android-debug-builds-only/

Basically, you'd need to have a debug version of your Application in the debug folder, with a debuggable version of Fabric, alongside with the manifest file, that is going to address your DebugApp:

<manifest
    package="com.mycompany"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        tools:replace="android:name"
        android:name=".DebugApp"/>

</manifest>
Ghedeon
  • 1,643
  • 1
  • 18
  • 30