Proper way to initialize Fabric.io for debugging/release
Asked Answered
M

3

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().

Merger answered 11/6, 2015 at 12:16 Comment(0)
L
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());
Lollis answered 12/6, 2015 at 7:14 Comment(3)
How to disable Answers? similar kind of above, I tried but it is not able to disable for Debug BuildImpenetrability
@NaveenKumarM were u able to disable Answers for Debug buildsVillegas
Yes @ismailqbal use this code if(!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); }Impenetrability
J
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

Jessikajessup answered 12/6, 2015 at 5:22 Comment(0)
H
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>
Hutchins answered 6/2, 2018 at 19:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.