gpt4 book ai didi

java - 未找到类 "com.google.firebase.provider.FirebaseInitProvider"

转载 作者:行者123 更新时间:2023-12-01 21:51:09 27 4
gpt4 key购买 nike

之前,我的程序运行得很好。但是当我刚刚将 Android studio 更新到最新版本(2.2 于 2016 年 9 月 15 日构建)时,出现以下错误。当我构建它时,它说:构建成功,但是当我运行我的程序时出现此错误:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.androidtutorial, PID: 28293 java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5814) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5799) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)  at android.app.ActivityThread.-wrap2(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6077)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

我已经看过其他问题,但问题不一样。我究竟做错了什么?请帮忙

最佳答案

您似乎遇到了超过 64K 方法的问题,然后尝试使用 build.gradle(应用程序模块)中的 multiDexEnabled true 来解决该问题。但您需要添加的不仅仅是:

  1. 添加:在build.gradle的依赖项中编译'com.android.support:multidex:1.0.0'

  2. 将您的 Application 类扩展为 MultiDexApplication。并在Application类的onCreated方法中添加MultiDex.install(this);

您的问题应该得到解决

引用链接:https://developer.android.com/studio/build/multidex.html

关于java - 未找到类 "com.google.firebase.provider.FirebaseInitProvider",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39812558/

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