我在FCM網站上的步驟後,在應用程序上實施了新的FCM。嘗試運行應用程序時,FirebaseInitProvider發生崩潰
現在,我試圖運行應用程序,但是當我嘗試它,應用程序崩潰與此錯誤:
05-30 12:28:45.788 3002-3002/es.in2.otr.app.im E/AndroidRuntime: FATAL EXCEPTION: main
Process: es.in2.otr.app.im, PID: 3002
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.res.Resources.getResourcePackageName(int)' on a null object reference
at android.app.ActivityThread.installProvider(ActivityThread.java:6765)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6357)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6297)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.res.Resources.getResourcePackageName(int)' on a null object reference
at com.google.android.gms.common.internal.zzah.<init>(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1789)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1764)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:6762)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6357)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6297)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
正如我所看到的,THRE方法試圖得到一些值,其中一片空白。
我搜索瞭解決方案,並在SO中找到了這篇文章。 - >Unable to get provider com.google.firebase.provider.FirebaseInitProvider
至於解決方案,他們說的applicationID添加到gradle這個構建項目文件,但我得到了它:
defaultConfig {
applicationId "es.in2.otr.app.im"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
testApplicationId "es.in2.otr.app.im.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
及劇照崩潰。
有沒有一些workaorund或解決這個問題?
艾菲爾特2個月我回來了,同樣的問題。現在它發生在我簽署APK並嘗試測試它時。已知的解決方案? – Shudy