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.
Try this code
or
For the time being, I solved the problem the old Java way:
Extend
Answers
using a sort-of singleton:Initialize Crashlytics with Answers implementation:
Use Answers implementation for events:
This will disable events being logged.
Note that, as described in my first post,
Answers.getInstance()
will return null and not yourCustomAnswers
instance in that case.on my app we do it the old fashioned way:
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:
edit:
I would advise against using BuildConfig.DEBUG, see this article: http://www.digipom.com/be-careful-with-buildconfig-debug/