使用play-services-xxx后,Firebase错误无法访问zzanb:9.8.00

时间:2016-10-23 13:00:39

标签: android firebase firebase-authentication

当我使用最新版本的com.google.android.gms时,我收到以下消息:play-services-xxx:9.8.00

Error:(32, 28) error: cannot access zzanb class file for com.google.android.gms.internal.zzanb not found

错误是由调用语句引起的: FirebaseAuth.getInstance().getCurrentUser().getUid();

如何解决此问题? 谢谢。

更新:问题已解决

最新更新的firebase版本9.8.0与google-service版本9.8.0兼容。现在,一切正常。

注意:Firebase和Google Play服务始终具有相同的版本。 @see Ian Barber 以下评论。

4 个答案:

答案 0 :(得分:8)

9.8.0是意外的早期发布。请不要使用它!如果您在10月22日至23日的周末碰巧更新了Android工具,则可能会意外收到此更新。要删除它,只需卸载并重新安装Google Repository工具。

答案 1 :(得分:5)

当我最近升级我的播放服务依赖时,我遇到了类似的错误。当您省略更新与您使用的播放服务版本相对应的firebase依赖项时,似乎会发生这种情况。

以下是我的依赖项的两个版本:

依赖项的错误版本

compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:9.8.0'

依赖项的工作版本 ``

compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:10.0.0'

`` 谷歌似乎最近将游戏服务更新与firebase更新一起移动。希望这可以节省一些灵魂。

答案 2 :(得分:3)

build.gradle(模块应用程序)警告中存在一个棘手的不一致,可能导致此错误。我把所有的游戏服务编译成了:

compile 'com.google.android.gms:play-services-drive:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
--- etc ---

变灰了,注意到在我升级各种Google Play广告后,可以使用较新的版本,即9.8.0。将所有播放服务编译更改为9.8.0后:

compile 'com.google.android.gms:play-services-drive:9.8.0'
compile 'com.google.android.gms:play-services-plus:9.8.0' 
---etc---

我得到了一个奇怪的错误:

class file for com.google.android.gms.internal.zzanb not found

尝试编译我的代码。棘手的是我的所有firebase编译:

compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-invites:9.6.1'
---etc---

没有变灰,所以我在升级播放服务编译的同时忽略了升级这些编译。将所有firebase编译升级到9.8.0:

compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-invites:9.8.0'
--- etc ---

修正了错误。

此外,当您收到此错误时,监视器中的警告建议按下“弃用”和“未选中”的lint警告。这是不必要的,并没有解决它。

Android Studio应该将firebase和play-services组合在一起以避免此错误,特别是因为错误消息非常含糊并且lint警告抑制建议不起作用。

答案 3 :(得分:0)

最后,我回到com.google.android.gms:play-services-xxx:9.6.1。 我发现问题的出现是因为firebase版本和gms版本之间存在差异。目前,Firebase在版本9.6.1上运行