Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Google Play Services for Android Studio 2.2 emulators?

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:

enter image description here

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

like image 960
Jim In Texas Avatar asked Jun 13 '16 20:06

Jim In Texas


People also ask

How do I update my Android emulator?

Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences). In the left panel, click Appearance & Behavior > System Settings > Updates. Be sure that Automatically check for updates is checked, then select a channel from the drop-down list (see figure 1). Click Apply or OK.


2 Answers

This may not be relevant to this question now, but wanted to post it here for future explorers, so that they see some land at the end of the sea. I had been struggling with this out of date Google Play Service on my Nexus 5 x86 emulator running API 25 and trying Firebase notification. I am using Firebase 10.0.1 which needs Google Play Services 10.0.1. But on my emulator, I always used to get the message

W/GooglePlayServicesUtil: Google Play services out of date. Requires 1008400 but found 9874900

W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}

I had searched extensively a way to update the Google Play Services on my emulator, and whatever was suggested never worked. Finally, I tried creating a new emulator Nexus 5 x86_64 and API 24. Voila!!! It has Google Play Services 10.0.1 and my app works now.

It really beats me why the x86 image does not have the latest Google Play Serviecs and it does not allow me to update it in any manner, while the x86_64 image has the latest Google Play Services.

Hope this helps someone struggling with Google Play Services.

like image 61
sukural Avatar answered Sep 20 '22 23:09

sukural


As for my case, I tried checking for updates on Android Studio, as well as the Google Play Services, and restarted Android Studio. Then the update dialog appeared, which allows me to update the emulator images with the correct Google Play Services version.

enter image description here

Wait for the update to finish, then create new AVDs based on the newly updated images, and everything is good to go.

like image 28
Nicholas Lie Avatar answered Sep 21 '22 23:09

Nicholas Lie