Search code examples
androidfirebasecrashlyticscrashlytics-android

Prevent Firebase-Crashlytics from sending version numbers when collection is disabled


During development and in QA tests we compile our apps in release mode to ensure everything is OK.

We don't want crash reporting during development, so we put this in the AndroidManifest.xml:

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

In our application's onCreate:

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(BuildConfig.crashlytics_enabled);

In app's build.gradle:

...    
apply plugin: 'com.google.firebase.crashlytics'
...
android {
    ...
    buildTypes {
        release {
            buildConfigField "boolean", "crashlytics_enabled", (isOfficialRelease() || isDailyJob()) ? "true" : "false"
            minifyEnabled true
            if (buildConfigFields.get("crashlytics_enabled").getValue() == "false" && minifyEnabled) {
                firebaseCrashlytics {
                    mappingFileUploadEnabled false
                }
            }
        }
    }
}
...
apply plugin: 'com.google.gms.google-services'

The problem is, even when crashlytics is disabled, we still get the version number & version name uploaded to crashlytics, and is clobbering up the filter dialog, so we are lost in a myriad of versions.

This is how our filter dialog looks now

Also, since Firebase Crashlytics only shows the last 100 versions, we may end in a situation where we may lose track of the official releases.

Is there a way to prevent the sending of versions altogether?


Solution

  • Aparently the correct key to add in AndroidManifest.xml is not

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

    but

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