How to disable Firebase Crash Reporting when the app is running on debug?

后端 未结 16 1306
谎友^
谎友^ 2020-12-04 13:42

I have successfully implemented Firebase Crash Reporting, but I need to disable the service when the app is running undo the \'debug\' Build Variant, in order to avoid non-r

16条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 14:41

    I use versionCode as filter for local/production builds.

    gradle.properties

    VERSION_CODE=1
    

    app/build.gradle

    android {
        defaultConfig {
            versionCode VERSION_CODE as int
        }
    }
    

    When publishing new version of app, just set new value from command line:

    ./gradlew build -PVERSION_CODE=new_value
    

    Otherwise, when you're building from Android Studio, you will always get the same versionCode, so you can easily distinguish crash reports in Firebase console.

提交回复
热议问题