问题
When using Crashlytics + Fabric for Android there is a really easy way to enable and disable crash reporting. I use it so during development and testing there aren't a ton of crashes alerting everyone.
Crashlytics crashlytics = new Crashlytics.Builder().disabled(true).build();
The disabled(boolean) method is now deprecated. Does anyone know what the replacement is for disabling and enabling crashlytics programmatically?
回答1:
Mike from Crashlytics and Fabric here.
Here's what you want to use depending on your preference:
CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
or
Fabric.with(this, new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build());
See CrashlyticsCore.Builder#disabled documentation.
来源:https://stackoverflow.com/questions/30488575/crashlytics-deprecated-method-disabled