Home > Blockchain >  How to prevent Crashlytics from logging crashes during development in Android
How to prevent Crashlytics from logging crashes during development in Android

Time:12-08

While developing the app sometimes it crashes, and It's known crash while development, It unnecessarily sends mail to the client that some Trending stability issues in the app.

So I want to know if any method is there to stop logging while the development journey.

CodePudding user response:

you can disable uploading of mapping file and symbols in debug build:

buildTypes {
        release {
            firebaseCrashlytics {
               mappingFileUploadEnabled true
               nativeSymbolUploadEnabled true
            }
        }
        debug {
            firebaseCrashlytics {
                // If you don't need crash reporting for your debug build,
                // you can speed up your build by disabling mapping file uploading.
                mappingFileUploadEnabled false
                nativeSymbolUploadEnabled false
            }
        }
    }
}

CodePudding user response:

Crashlytics gives you the option to opt in or out from sending crash reports. You could use this in your code to prevent sending crash reports during development.

For this you could set the firebase_crashlytics_collection_enabled property in the AndroidManifest.xml file to false.

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

With this option you will can then re-enable Crashlytics data collection when running the release version:

if(!BuildConfig.DEBUG){
   FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
}

Or a similar option could be disabling Crashlytics data collection only when running the debug build. In this case, the the manifest property is not required.

if(BuildConfig.DEBUG){
   FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(false);
}
  • Related