craigrussell

Technical blog from Craig Russell.

 

This post details how to disable crash reporting for your BuildConfig.DEBUG builds when using Crashlytics, part of the Fabric tool suite

Disabling Crashlytics Crash Reporting on DEBUG builds

In your Application subclass’s onCreate() method, you will set up your Crashlytics crash reporting.

public class YourApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        configureCrashReporting();
    }
    
    private void configureCrashReporting() {
        CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder()
                .disabled(BuildConfig.DEBUG)
                .build();
        Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build());
    }
    
}

You can use CrashlyticsCore.Builder() to customise the crash reporting. In this case, you say that crash reporting is disabled when BuildConfig.DEBUG is true.

With this, there will be no more annoying crash reports which happened during your day-to-day development. Now, why this isn’t the default, I have no idea.

Home