There are a number of variations of this question, however most are very old, and don't really answer the question at all. I'm NOT asking how to install Play Services, that is installed in the Studio 2.2 emulators.
The problem is that these emulators are using an old version of Play services.
When I run a test app that uses Firebase to facilitate Google login I get this alert dialog from a Nexus 5 API 23 emulator:
In the onCreate method of my login activity I have this code:
int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
switch(result) {
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Log.d(TAG,"SERVICE_VERSION_UPDATE_REQUIRED");
break;
case ConnectionResult.SUCCESS:
Log.d(TAG, "Play service available success");
break;
default:
Log.d(TAG, "unknown services result: " + result);
}
This always returns SERVICE_VERSION_UPDATE_REQUIRED.
Clicking update in the alert dialog does nothing that I can detected. In the debug log I get this message when Play Services startup fails:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9080000 but found 8489470
My application runs fine on a real Android device.
What simple thing am I missing?
TIA
Assuming you're using Android's default AVDs, as opposed to Genymotion, you just have to make sure everything has been updated.
This is what's working for me. If you are using using the current version of play services, 9.6.1 or higher, make sure of the following:
After ensuring all of that, and restarting Android Studio (because better safe than sorry), make a new AVD. I mainly use the following settings: - Nougat (API 24) - ABI - x86_64 - Target - Android 7.0 (with Google APIs)
This is working for me, as I was having the same problem this morning until I updated everything. Good luck :)
What worked for me is:
Check for and install any new updates. You specifically want to make sure that you're installing the newest version of Google Play Services. Also, you can check for the version of Google Play Services that you're using in the SDK Manager.
Delete all your emulators in the AVD (Android Virtual Device) Manager.
Create new emulator(s).
Should work fine afterwords!