gpt4 book ai didi

firebase - 无法获取提供程序 com.google.firebase.provider.FirebaseInitProvider

转载 作者:行者123 更新时间:2023-12-03 00:54:36 25 4
gpt4 key购买 nike

我正在测试新的崩溃工具: https://firebase.google.com/docs/crash/

完成这些步骤后,应用程序启动并崩溃,并显示:

05-18 17:28:18.870 28743 28743 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: Incorrect provider authority in manifest. Most likely due to a missing applicationId variable in application's build.gradle.
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Incorrect provider authority in manifest. Most likely due to a missing applicationId variable in application's build.gradle.
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
05-18 17:28:18.870 28743 28743 E AndroidRuntime: ... 10 more

最佳答案

1.

applicationId添加到应用程序的build.gradle中:

android {
...
defaultConfig {
applicationId "com.example.my.app"
...
}
}

并且比清理项目 -> 构建重建项目

<小时/>

2.如果您的 minSdkVersion <= 20 ( https://developer.android.com/studio/build/multidex )

正确使用 Multidex。

应用程序的build.gradle

android {
...
defaultConfig {
....
multiDexEnabled true
}
...
}

dependencies {
implementation 'com.android.support:multidex:1.0.3'
...
}

list .xml

<application
...
android:name="android.support.multidex.MultiDexApplication" >
...
<小时/>

3.

如果您使用自定义应用程序类

public class MyApplication extends MultiDexApplication {
@Override
protected void attachBaseContext(Context context) {
super.attachBaseContext(context);
MultiDex.install(this);
}
}

list .xml

<application
...
android:name="com.example.my.app.MyApplication" >
...

关于firebase - 无法获取提供程序 com.google.firebase.provider.FirebaseInitProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37312103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com