简体   繁体   中英

Cannot disable Crashlytics for debug on Android

I Have followed exactly this steps on android studio 2.3.2 to disable Crashlytics on my debug builds

https://docs.fabric.io/android/crashlytics/build-tools.html?highlight=disable#disable-crashlytics-for-debug-builds

my relevant app/build.gradle

 buildTypes {
        debug {
            applicationIdSuffix '.debug'
            versionNameSuffix '-DEBUG'
            // Disable fabric build ID generation for debug builds
            ext.enableCrashlytics = false
            testCoverageEnabled = false
            debuggable true
       }
  }

I got this stack trace

Error reading Beta build properties                                                                     java.io.FileNotFoundException: crashlytics-build.properties
                                                                     at android.content.res.AssetManager.openAsset(Native Method)
                                                                     at android.content.res.AssetManager.open(AssetManager.java:347)
                                                                     at android.content.res.AssetManager.open(AssetManager.java:321)
                                                                     at com.crashlytics.android.beta.Beta.loadBuildProperties(Beta.java:172)
                                                                     at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:75)
                                                                     at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:30)
                                                                     at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
                                                                     at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
                                                                     at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
                                                                     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                     at java.lang.Thread.run(Thread.java:761)

Make sure you imported the BuildConfig specific to your app's package name. One possibility that I thought of is, maybe you imported BuildConfig for one of your libraries by accident?

So when this line of code runs:

Crashlytics crashlyticsKit = new Crashlytics.Builder()
                .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
                .build();

It is actually pointing to a different BuildConfig , as there are multiple in projects and BuildConfig.DEBUG ends up being false.

This is just a guess, but something that could possibly accidentally go wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM