Why is Fabric not initialized? java.lang.IllegalStateException: Must Initialize Fabric before using singleton()

后端 未结 8 604
误落风尘
误落风尘 2021-02-06 22:26

I set up Firebase Crashlytics according to Get started with Firebase Crashlytics for my Android app (using Android studio 3.1.3). On my own device as well as on the Emulator, ev

8条回答
  •  礼貌的吻别
    2021-02-06 22:57

    In my case, The below checks helped to get rid of the error.

    If you find code like below in your manifest, set it to true or remove it since it's true by default.

        
    

    Also incase if the value is being pulled in from your build.gradle, check which buildType its in and consider not invoking any Crashlytics functions under that buildType.

    Example: build.gradle

    android{
    
        ...
    
       buildTypes {
            debug{
                manifestPlaceholders = [enableCrashReporting:"false"]
            }
            release {
                manifestPlaceholders = [enableCrashReporting:"true"]
            }
       }
    }
    

    In this case you should have your Crashlytics calls wrapped like this -

    if(!BuildConfig.DEBUG){
       ...
       Crashlytics.setUserIdentifier(...)
       ...
    }
    

提交回复
热议问题