Unable to disable Crashlytics in Firebase app (more)

After upgrading to com.crashlytics.sdk.android:crashlytics: 2.7.1@aar (since version 2.6.8) I can no longer disable Crashlytics in my Firebase application.

It seems that there is some code in the library Crashlytics, which initializes the Fabric via Crashlytics kit included, when he discovers that he is working within Firebase application. In fact, initialization with Crashlytics enabled and with ext.enableCrashlytics = false raises a UnmetDependencyException and causes the application to crash on startup (in fact, before running my code in Application.onCreate ).

Does anyone know about this? So far with 2.6.8 it works. This is what I have in my code that used to work before the update:

Application / build.gradle:

 ext.enableCrashlytics = false 

Application.java (onCreate, body of the full method on request):

 super.onCreate(); if (LeakCanary.isInAnalyzerProcess(this)) { return; } LeakCanary.install(this); // First Fabric invocation Fabric.with(this, new Crashlytics.Builder().core( new CrashlyticsCore.Builder().disabled(true).build()).build()); RxJavaPlugins.setErrorHandler(e -> LOGGER.error("Undeliverable RxJava error", e)); // First Firebase invocation FirebaseDatabase db = FirebaseDatabase.getInstance(); if (BuildConfig.DEBUG) { db.setLogLevel(com.google.firebase.database.Logger.Level.DEBUG); } db.setPersistenceEnabled(true); 
+15
source share
3 answers

Mike from Cloth. Using:

 <meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" /> 

if you want to disable Crashlytics when using Firebase.

+22
source

according to mike answer, im add my code:

Gradle:

 buildTypes { release { manifestPlaceholders = [crashlyticsEnabled: true] } debug { manifestPlaceholders = [crashlyticsEnabled: false] } } 

Manifest.xml:

 <meta-data android:name="firebase_crashlytics_collection_enabled" android:value="${crashlyticsEnabled}" /> 
+32
source

Along with Michael above is the answer,

If you set the Firebase crash properties somewhere in your code, make sure that you do not set them for the debug code, otherwise you may notice strange behavior for the application.

  if (!BuildConfig.DEBUG) { Crashlytics.setUserIdentifier(DataStore.storeId) } 
0
source

All Articles