无法获得提供商com.google.firebase.provider.FirebaseInitProvider?

时间:2017-10-30 11:16:33

标签: android firebase

如何解决此错误?
Android studio 2.3.3
Ubuntu 14.04 LTS

androidRuntime: FATAL EXCEPTION: main
                                                                         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.midhilaj.ssfnewsapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.midhilaj.ssfnewsapp-1, /vendor/lib, /system/lib]]
                                                                             at android.app.ActivityThread.installProvider(ActivityThread.java:5121)
                                                                             at android.app.ActivityThread.installContentProviders(ActivityThread.java:4681)
                                                                             at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4621)
                                                                             at android.app.ActivityThread.access$1300(ActivityThread.java:165)
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1433)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                             at android.os.Looper.loop(Looper.java:194)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5391)
                                                                             at java.lang.reflect.Method.invokeNative(Native Method)
                                                                             at java.lang.reflect.Method.invoke(Method.java:525)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
                                                                             at dalvik.system.NativeStart.main(Native Method)
                                                                          Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.midhilaj.ssfnewsapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.midhilaj.ssfnewsapp-1, /vendor/lib, /system/lib]]
                                                                             at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
                                                                             at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
                                                                             at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
                                                                             at android.app.ActivityThread.installProvider(ActivityThread.java:5106)
                                                                             at android.app.ActivityThread.installContentProviders(ActivityThread.java:4681) 
                                                                             at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4621) 
                                                                             at android.app.ActivityThread.access$1300(ActivityThread.java:165) 
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1433) 
                                                                             at android.os.Handler.dispatchMessage(Handler.java:107) 
                                                                             at android.os.Looper.loop(Looper.java:194) 
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5391) 
                                                                             at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                             at java.lang.reflect.Method.invoke(Method.java:525) 
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
                                                                             at dalvik.system.NativeStart.main(Native Method) 

1 个答案:

答案 0 :(得分:0)

首先在firebase控制台上注册你的应用程序并按照那里提到的步骤记住将google-service.json文件与你项目中的app文件夹平行。