How to disable Crashlytics during development

后端 未结 28 2597
心在旅途
心在旅途 2020-11-29 15:42

Is there any simple way to turn Crashlytics Android SDK off while developing ?

I don\'t want it to send a crash every time I do something stupid

On the othe

28条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 15:56

    Step 1: In build.grade

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

    Step 2: In manifest

    
    

    Step 3: In Application or first Activity

    private void setupCrashReport() {
            if (BuildConfig.DEBUG) return;
            Fabric.with(this, new Crashlytics());
        }
    

    I am not sure if the step 3 is necessary, but to make sure the release version should work without crash. source: https://firebase.google.com/docs/crashlytics/customize-crash-reports#enable_opt-in_reporting

提交回复
热议问题