cprcrack
cprcrack

Reputation: 19139

Firebase unexpectedly requires a newer version of Google Play Services

I was using Firebase with the following versions in my Android app project:

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'

Then I updated my app to use the last version of Firebase, so replaced all 11.2.0 with 11.8.0 in all dependencies. It compiles fine, but now, when calling FirebaseAuth.getInstance().signInAnonymously(), the callback never returns and the sign in is not performed. This error is silent, but I had a look at the console, and I found:

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

Apparently my phone has version 11.5.18 of Google Play Services installed (thus the number 11518438). I know, updating Google Play Services should fix it, BUT, how is this supposed to work in a production environment? I'm sure there will a lot of users whose Google Play Services app will also be outdated. Does this mean that all of those users will suddenly have an app that doesn't work when they update it?

I know I can use makeGooglePlayServicesAvailable() but it just doesn't feel right (for example the user might not have Internet or space for an update). Will the user be forced to update every time a new version is needed? And, where is it documented that Firebase version X requires Google Play Services version X? I cannot see anything on Firebase release notes.

Upvotes: 1

Views: 1045

Answers (2)

tyczj
tyczj

Reputation: 73753

Piggybacking on what Doug said you should be checking in your app for the correct version of google play services you compiled against

GoogleApiAvailability mApiAvail = GoogleApiAvailability.getInstance();
int status = mApiAvail.isGooglePlayServicesAvailable(this);
if(status != ConnectionResult.SUCCESS){
    mApiAvail.showErrorDialogFragment(this,status,1234);
}

This would show a dialog to the user saying they need to update/enable google play services.

This fixes the case where the device was not updated to the version you need.

...but it just doesn't feel right (for example the user might not have Internet or space for an update). Will the user be forced to update every time a new version is needed?

When you update your google play services for your app you have then declared that your app cannot function without at least that version of Google Play Services so you are forcing the user to update to be able to use your app. It is then up to the user to decide if they want to do that or not.

where is it documented that Firebase version X requires Google Play Services version X? I cannot see anything on Firebase release notes.

Firebase is part of google play services which is why they need to be the same version

Upvotes: 3

Doug Stevenson
Doug Stevenson

Reputation: 317497

The release of new Play Services and Firebase SDKs only occurs after the Play Services APK has been made available to 100% of supported Android devices. The expectation is that these devices will self-update their Play APK. If that hasn't happened on a user's device for whatever reason, the user is typically prompted to update their Play Services before running the app that makes use of it.

A vast majority of the time, the update happens transparently and the user never knows (or needs to know) what happened. If you're withholding Play Services from your device, that is not a typical situation.

Upvotes: 3

Related Questions