Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Crashlytics Answers?

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.

like image 396
jbxbergdev Avatar asked Aug 12 '15 11:08

jbxbergdev


People also ask

How do I disable Crashlytics?

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.

How do I turn off Firebase 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.

What is the use of Crashlytics in Android?

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.


1 Answers

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/

like image 142
Budius Avatar answered Sep 18 '22 13:09

Budius