Ionic Android RuntimeException FirebaseInitProvider IllegalArgumentException:给定String为空或null

时间:2018-05-04 11:16:17

标签: android ionic-framework ionic2 cordova-plugin-fcm

使用Ionic进行项目构建。在Android SDK中生成Android构建和导入后。

在设备/模拟器中运行应用程序时出错。同时使用FCM进行推送通知。

安装APK后

Android运行时错误:

--------- beginning of crash

2018-05-04 16:34:30.077 14810-14810/com.app.name E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.app.name, PID: 14810
    java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalArgumentException: Given String is empty or null
        at android.app.ActivityThread.installProvider(ActivityThread.java:5856)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.IllegalArgumentException: Given String is empty or null
        at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(Unknown Source)
        at com.google.firebase.auth.api.internal.zzcq.<init>(Unknown Source)
        at com.google.firebase.auth.FirebaseAuth.<init>(Unknown Source)
        at com.google.firebase.auth.internal.zzj.<init>(Unknown Source)
        at com.google.firebase.auth.zzo.create(Unknown Source)
        at com.google.firebase.components.zzi.zza(Unknown Source)
        at com.google.firebase.components.zzj.get(Unknown Source)
        at com.google.firebase.components.zzi.get(Unknown Source)
        at com.google.firebase.components.ComponentContainer$$CC.get(Unknown Source)
        at com.google.firebase.components.zzg.get(Unknown Source)
        at com.google.firebase.components.zzg.zzb(Unknown Source)
        at com.google.firebase.FirebaseApp.zzc(Unknown Source)
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 
        at android.app.ActivityThread.-wrap2(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)  

我的配置是否有问题,或者在处理Android版本时是否缺少某些内容?

1 个答案:

答案 0 :(得分:0)

我也有同样的问题,现在解决了这个问题。 在我的情况下,空值或空值是google-services.json中的“current_key”值,因此我填写了Firebase控制台中的值(Web API密钥)