我在Android应用程序项目中使用具有以下版本的Firebase:

compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.android.gms:play-services-ads:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'

//...
apply plugin: 'com.google.gms.google-services'


然后,我更新了我的应用程序以使用Firebase的最新版本,因此在所有依赖项中将所有11.2.0替换为11.8.0。它可以正常编译,但是现在,调用FirebaseAuth.getInstance().signInAnonymously()时,回调将永远不会返回,并且不会执行登录。该错误是无声的,但我查看了控制台,发现:

Google Play services out of date.  Requires 11910000 but found 11518438


显然,我的手机安装了11.5.18版的Google Play服务(因此编号为11518438)。我知道,更新Google Play服务应该解决它,但是,这在生产环境中应该如何工作?我敢肯定会有很多用户的Google Play服务应用也将过时。这是否意味着所有这些用户在更新应用时都会突然拥有无法使用的应用?

我知道我可以使用makeGooglePlayServicesAvailable(),但是感觉不对(例如,用户可能没有Internet或更新空间)。每次需要新版本时,都会迫使用户进行更新吗?而且,在哪里记录到Firebase X需要Google Play服务X?我在Firebase release notes上看不到任何内容。

最佳答案

仅当Play Services APK已可用于100%受支持的Android设备后,才会发布新的Play Services和Firebase SDK。期望这些设备将自我更新其Play APK。如果出于某种原因在用户的设备上没有发生此情况,则通常会提示用户在运行使用该服务的应用程序之前先更新其Play服务。

在绝大多数情况下,更新是透明发生的,用户永远不知道(或需要知道)发生了什么。如果您要从设备中保留Play服务,则不是典型情况。

关于android - Firebase意外需要更新版本的Google Play服务,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48467283/

10-09 01:39
查看更多