我实现了新的FCM上的应用程序后的FCM网络上的步骤。
现在,我试图运行的应用程序,但是当我尝试它,应用程序崩溃与此错误:
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。 - > 无法获取提供商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或解决这个问题?