Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New Firebase Crashlytics disable in debug mode

I have recently switched to new Firebase Crashlytics from Fabric one and I can't find alternative for disabling Crashlytics in debug mode.

Fabric:

val crashlytics = Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build() Fabric.with(this, crashlytics, Answers()) 

Anyone know answer? Ive seen that FirebaseCrashlytics class has its core set up internally now. I've tried FirebaseCrashlytics(CrashlyticsCore.??).getInstance(), but that kind of constructor is not working.

Also CrashlyticsCore class no longer has .Builder() available

like image 314
martin1337 Avatar asked Jun 16 '20 07:06

martin1337


People also ask

How do I disable Firebase Crashlytics in debug mode?

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.

How do I debug Crashlytics?

Enable debug logging for CrashlyticsSelect Run from the left menu, then select the Arguments tab. In the Arguments Passed on Launch section, add -FIRDebugEnabled .


1 Answers

To do it programmatically use below code in Application class

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG) //enabled only for signed builds 

Enable collection for select users by calling the Crashlytics data collection override at runtime. The override value persists across launches of your app so Crashlytics can automatically collect reports for future launches of that app instance. 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.

Here is the link to documentation https://firebase.google.com/docs/crashlytics/customize-crash-reports?platform=android#enable-reporting

like image 188
Manohar Avatar answered Sep 24 '22 00:09

Manohar