How to update Google Play Services on the emulator in Android Studio

被刻印的时光 ゝ 提交于 2019-12-18 11:33:23

问题


Hi I am trying to run an Android Program I have created that can connect to Firebase with Authentication using email and password but it seems that I cannot even authenticate due to the fact of them saying my Google Play Service is not up to date.

I am stump here as I have the latest google play services according to my SDK manager

and I don't think it is my code's problem as when I use my friend's phone for debugging it works but not when I am using the emulator.

How can I update my google play services in the Android Studio built-in emulator.


回答1:


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

When creating Emulator use images that support Google Playstore (currently Nexus 5 and Nexus 5x with android O)

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.

Edit: Make sure that you use emulator with playstore is installed. Check if you have sdk manager -> sdk platforms -> Android 8 -> Google Play ... system image installed. Download it. Create new emulator using that image.




回答2:


I had the same issue and spent half a day working it out.

In your emulator, go to settings->apps->Google Play Services and compare the version used to what appears in your build.gradle file.

In my case the emulator was running an earlier version and no amount of updates seemed to change it.

In build.gradle, I changed the following:

compile 'com.google.android.gms:play-services:9.6.1' 

to

compile 'com.google.android.gms:play-services:8.+'

After which I restarted android-studio and it worked flawlessly.




回答3:


I was facing same issue, but i downgrade my play services version in build.gradle.

  1. settings->apps->Google Play Services application check image
  2. my google play services version is 10.2.98, that's why we need google-play-services(in module level build.gradle) version lower than our emulator's library version.
  3. set the lower version from here, we can see 10.2.6 is better and set it in build.gradle like this compile 'com.google.android.gms:play-services-places:10.2.6' and just simple, run app again.



回答4:


Try to download and install the latest APK for Play Services as stated in this thread.

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.

Be noted that updates might not reach all users immediately, so your app should verify the version available before attempting to perform API transactions.



来源:https://stackoverflow.com/questions/39848314/how-to-update-google-play-services-on-the-emulator-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!