I am trying to implement my app, following the instructions from https://developers.google.com/android/guides/setup, setting the Google Play Services at 9.8.0 in my build.gradle file. As described in How to update Google Play Services to 9.8.7, for testing on an emulator I should downgrade the service. However, it also indicates it should work on a physical device.
compile 'com.google.android.gms:play-services:9.8.0'
I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9877000 but found 9384448
E/MainActivity: Connection to Google API client has failed
I've updated the Google Play Services in the SDK Manager/Tools (version 37), but am running out of ideas. I am unsure how to downgrade the Google Play Services on the Pixel. Am I missing something (possibly obvious?)
EDTI: See the answer, I was missing the correct version of Google Play Services on the phone. The solution implements a check to prevent future mistakes.
You should add some code to check if there is an update required. Like this below.
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
googlePlayServicesAvailable = googleApiAvailability.isGooglePlayServicesAvailable((Variables.context));
if ((googlePlayServicesAvailable == ConnectionResult.SERVICE_MISSING) || (googlePlayServicesAvailable == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) || (googlePlayServicesAvailable == ConnectionResult.SERVICE_DISABLED)) {
activity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
googleApiAvailability.getErrorDialog(((Activity) Variables.context), googlePlayServicesAvailable, 0);
}
You should modify my code to:
ActivityNotFoundException