Play Services 9.2.1中的Firebase NullPointerException

时间:2022-11-06 15:23:59

I updated Google Play Services in my app from 8.4.0 to 9.2.1 and started seeing the following crash coming in multiple times per day:

我在我的应用程序中将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)

I am not explicitly including Firebase nor have I migrated from GCM yet, but I do have google services in my app. I think Firebase coming in through a dependency of my other play-services integrations or the google-services plugin. Here's a snippet of my build.gradle file:

我没有明确包含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 crash seems very similar to this one but it's coming from getInstance() rather than getToken() so I'm wondering if anyone knows if I'm missing an integration or something like that? I'm hoping that the only answer isn't to wait for google to fix.

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

UPDATE: I added Firebase to my app through the dashboard, then generated a new google-services.json file, repackaged my app and released a patch. This did not seem to fix the problem, as I am still seeing occurrences in Crashlytics in the new version.

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

UPDATE 2: I still haven't found a solution, but I've noticed that these crashes are tapering off in Crashlytics. I had 40 the first day, 30 the second day, 10 the third day, and now down to ~4. This leads me to believe that this bug only affects new users or updating users, of which there were a lot initially as my users' apps upgraded to the new version. I still think this is a bug on Google's end and hope they will fix, but at least it's not as widespread as I initially thought.

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

1 个解决方案

#1


1  

As described in my updates, after a few days I saw fewer and fewer of these errors, until now a few weeks later I'm not seeing them at all anymore. So I guess the answer is that this intermittently affects users that are updating their apps, and eventually dies down on its own. Most likely no action is needed on the developer's part.

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

#1


1  

As described in my updates, after a few days I saw fewer and fewer of these errors, until now a few weeks later I'm not seeing them at all anymore. So I guess the answer is that this intermittently affects users that are updating their apps, and eventually dies down on its own. Most likely no action is needed on the developer's part.

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