Home » Android » updating Google play services in Emulator

updating Google play services in Emulator

Posted by: admin December 20, 2017 Leave a comment

Questions:

I have gone through many questions like this on Google Play, I am using Android 4.2.2 API 17.

My app requires Google play services 8.1 , It compiles fine and when it runs on emulator it shows message that ‘You need to update your Google play services ‘ ,

When I click on update nothing happens,

How can I update the Google Play services without downloading any latest API version ?

Answers:

Update On 18-Dec-2017

You can update Google Play Services via the Play Store app in your emulator just as you would on a physical Android device.

Emulator new features added with stable update from Android Studio v 3.0

Google Play Support – We know that many app developers use Google Play
Services, and it can be difficult to keep the service up to date in
the Android Emulator system images. To solve this problem, we now
offer versions of Android System Images that include the Play Store
app. The Google Play images are available starting with Android Nougat
(API 24)
. With these new emulator images, you can update Google Play
Services via the Play Store app in your emulator just as you would on
a physical Android device. Plus, you can now test end-to-end install,
update, and purchase flows with the Google Play Store.


Quick Boot – Quick Boot allows you to resume your Android Emulator
session in under 6 seconds

Android CTS Compatibility

Performance Improvements – With the latest versions of the Android
Emulator, we now allocate RAM on demand, instead of allocating and
pinning the memory to the max RAM size defined in your AVD.

Virtual sensors

Wi-Fi support

GPS location

OR

Update this SDK Build-Tools and Android Emulator to latest and this alert message will not come again,

Settings –> Android SDK –> SDK Tools(tab) –> Android SDK
Build-Tools

enter image description here

Questions:
Answers:

Use emulator that has Play Store installed. Updating play services would be as easy as in real device.

Since Google introduced Google Play Store images in Android SDK Tools 26.0.0 now emulators comes with installed Google Play Store.

enter image description here

From 26.0.3

  • Adds a new tab in the extended window for Google Play Store images that displays the Play Services version and a button to check for updates to Play Services.

emulator settings

Questions:
Answers:

Based from Google documentation,

If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.

Try to navigate to settings–> apps in your emulator and then find Google Play Services. Check the version number and use it in you build.gradle. To update it with the latest version, you can see it in these documentation and SO question.

Questions:
Answers:

My answer is not to update the Google play service but work around.
Get the play service version of the emulator by using the following code

getPackageManager().getPackageInfo("com.google.android.gms", 0 ).versionName);

For example if the value is “9.8.79” then use the nearest lesser version available com.google.android.gms:play-services:9.8.0′

This will resolve your problem. Get the release history from https://developers.google.com/android/guides/releases#november_2016_-_v100

Questions:
Answers:

Running the app on a virtual device with system image, ‘Google Play API’ instead of ‘Google API’ will solve your issue smoothly..

  • Virtual devices Nexus 5x and Nexus 5 supports ‘Google Play API’ image.

  • Google Play API comes with Nougat 7.1.1 and O 8.0.

Just follow the below simple steps and make sure your pc is connected to internet.

  1. Create a new virtual device by selecting Create Virtual Device(left-bottom corner) from Android Virtual Devices Manager.

  2. Select the Hardware ‘Nexus 5x’ or ‘Nexus 5’.

  3. Download the system image ‘Nougat’ with Google Play or ‘O’ with Google Play. ‘O’ is the latest Android 8.0 version.

  4. Click on Next and Finish.

  5. Run your app again on the new virtual device and click on the ‘Upgrade now ‘ option that shows along with the warning message.

  6. You will be directed to the Play Store and you can update your Google Play services easily.

See your app runs smoothly!

  • Note: If you plan to use APIs from Google Play services, you must use the Google APIs System Image.
Questions:
Answers:

I faced the same issue. I updated my Android studio and used API 25 target as Android 7.1.1 and X86 and everything worked fine. I use Google play services and firebase for my project

Questions:
Answers:

In addition to answer

You need to update Android Emulator also

enter image description here

Questions:
Answers:

Tried only on Android 4.3 and Android 4.4

Download this file ( PrebuiltGmsCore.apk )

PrebuiltGmsCore.apk

Put it in the platform-tools folder of your Android SDK containing the adb.exe file. Usually “C:\Users\%User_Account_Name%\AppData\Local\Android\Sdk\platform-tools”

Then open command prompt in this location and type the following command. Make sure you have only one emulator running.

adb install -r PrebuiltGmsCore.apk

You should get a success message. Your Google Play Services should now be updated.