updating Google play services in Emulator

2019-01-01 05:45发布

问题:

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 ?

回答1:

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 from API 24.

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

Google Play Support - From Google : 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 and Many more...

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



回答2:

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

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



回答3:

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.



回答4:

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.


回答5:

You need install Google play image, Android SDK -> SDK platforms --> check show Package details --> install Google play. \"enter



回答6:

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



回答7:

the answers on this page eluded me until i found the show package details option

\"enter



回答8:

I was having the same issue. Just avoid using an emulator with SDK 27. SDK 26 works fine!



回答9:

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