Crashlytics错误 - 此应用程序依赖于Crashlytics。请注册访问

2022-09-01 04:44:24

我在gradle中有两种构建风格,但由于某种原因,每当我将以下标志更改为false时,我都会收到标题错误消息:

ext.enableCrashlytics = false

错误本身完成如下:

Process: com.mobile.myapp.staging, PID: 5439
java.lang.RuntimeException: Unable to create application com.mobile.myapp.UI.myappApplication: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:234)
at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:207)
at io.fabric.sdk.android.InitializationTask.onPreExecute(InitializationTask.java:44)
at io.fabric.sdk.android.services.concurrency.AsyncTask.executeOnExecutor(AsyncTask.java:611)
at io.fabric.sdk.android.services.concurrency.PriorityAsyncTask.executeOnExecutor(PriorityAsyncTask.java:43)
at io.fabric.sdk.android.Kit.initialize(Kit.java:69)
at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:440)
at io.fabric.sdk.android.Fabric.init(Fabric.java:384)
at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:342)
at io.fabric.sdk.android.Fabric.with(Fabric.java:313)
at com.mobile.myapp.UI.base.BaseApplication.setupExceptionHandling(BaseApplication.java:51)
at com.mobile.myapp.UI.myappApplication.onCreate(myappApplication.java:45)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)

这就是我在应用程序子类中初始化 crashlytics 的方式:

Fabric.with(this, new Crashlytics());

我试图做的是控制崩溃剂是否可以运行每种口味。假设我希望slave1不要运行crashlytics,我认为我可以使用该gradle标志并将其设置为false。我错过了什么吗?


答案 1

可能缺少应用插件结构

我在文件顶部添加了此行解决了我的问题!app/build.gradle

应用插件:'io.fabric'


答案 2

每当我设置

ext.enableCrashlytics = false

我的应用崩溃了

io.fabric.sdk.android.services.concurrency.UnmetDependencyException

This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, install an Android build tool and ask a team member to invite you to this app's organization.

对我来说似乎有效的是,我必须通过将此行添加到AndroidManifest来禁用Crashlytics的自动初始化.xml

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

然后,我在应用程序子类的onCreate()方法中手动初始化Crashlytics,使用BuildConfig.DEBUG决定是否禁用CrashlyticsCore,并调用Fabric.with()。事实上,我不再设置

ext.enableCrashlytics = false

完全。对我来说,这一切似乎都有效。


推荐