当我的某个版本 Android(4.1)的应用用户遇到此错误时,我收到了一个奇怪的错误。
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider
at android.app.ActivityThread.installProvider(ActivityThread.java:4298)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4050)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4004)
at android.app.ActivityThread.access$1300(ActivityThread.java:126)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1193)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4482)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4283)
我不明白为什么会发生这种错误。我的Firebase初始化代码如下:
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
if (d.appuserexists(email)==true){
d.appusermsgid(email,refreshedToken);
}
它指的是我的AWS数据库,如果用户已经存在于系统中,则会刷新Firebase令牌。