Disabling Crashlytics error reporting is relatively straight forward.. I'd also like to disable Answers for debug builds. However,
new Crashlytics.Builder().answers(null);
doesn't work since apparently answers can't be null and
new Crashlytics.Builder().answers(new CustomAnswers());
with CustomAnswers being my class extending Answers gets me a NPE when calling Answers.getInstance()
. But that approach is cumbersome to begin with compared to simply calling some enable() method.
Any ideas?
On a side note, I really hope Fabric is going to update and improve their docs soon.
Here's a couple of ways to disable Crashlytics while you are doing your debug builds! Use a different android:versionString for debug and release builds and then disable crash reporting from the Crashlytics web dashboard for the debug version. Wrap the call to Crashlytics.
To opt out of automatic crash reporting, pass false as the override value. When set to false, the new value does not apply until the next run of the app. To disable the crash logs while in debug mode you must pass ! BuildConfig.
Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them. Find out if a particular crash is impacting a lot of users. Get alerts when an issue suddenly increases in severity. Figure out which lines of code are causing crashes.
on my app we do it the old fashioned way:
if (!IS_DEBUG) {
Fabric.with(this, new Crashlytics());
}
works fine.
Of course you can initialise with whichever custom parameters you need.
edit:
to get the debug boolean is just a matter of using gradle to your favour:
src/
main/ // your app code
debug/
AppSettings.Java:
public static final boolean IS_DEBUG = true;
release/
AppSettings.Java:
public static final boolean IS_DEBUG = false;
edit:
I would advise against using BuildConfig.DEBUG, see this article: http://www.digipom.com/be-careful-with-buildconfig-debug/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With