Play Services 9.2.1中的Firebase NullPointerException

时间:2016-07-15 22:30:14

标签: android firebase google-play-services

我在我的应用中将Google Play服务从8.4.0更新为9.2.1,并开始每天多次发生以下崩溃:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
       at android.util.Base64.decode(Base64.java:118)
       at com.google.firebase.iid.zzg.zzkl(Unknown Source)
       at com.google.firebase.iid.zzg.zzh(Unknown Source)
       at com.google.firebase.iid.zzd.zzb(Unknown Source)
       at com.google.firebase.iid.zzd.zzcxa(Unknown Source)
       at com.google.firebase.iid.zzd.zzbmu(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceId.zzcww(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceIdService.zzaa(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
       at com.google.firebase.iid.zzb$2.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

我没有明确包含Firebase,也没有从GCM迁移,但我的应用程序中确实有谷歌服务。我认为Firebase是通过我的其他播放服务集成或google-services插件的依赖来实现的。这是我的build.gradle文件的片段:

compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-gcm:9.2.1'

此崩溃似乎与this one非常相似,但它来自getInstance()而不是getToken()所以我想知道是否有人知道我是否缺少集成或类似的东西?我希望唯一的答案是不要等待谷歌修复。

更新:我通过信息中心将Firebase添加到了我的应用,然后生成了一个新的google-services.json文件,重新打包了我的应用并发布了补丁。这似乎没有解决问题,因为我仍然看到新版本中Crashlytics的出现。

更新2:我还没有找到解决方案,但我注意到这些崩溃在Crashlytics中逐渐减少。我第一天40,第二天30,第三天10,现在下降到~4。这让我相信这个bug只会影响新用户或更新用户,最初我的用户应用升级到新版本时会有很多用户。我仍然认为这是谷歌的一个错误,希望他们能解决这个问题,但至少它没有我最初想象的那么广泛。

1 个答案:

答案 0 :(得分:1)

正如我的更新中所描述的那样,几天之后我发现这些错误越来越少,直到现在几周后我再也看不到它们了。所以我想答案是,这会间歇性地影响正在更新其应用程序的用户,并最终自行消失。很可能开发人员不需要采取任何措施。