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

前端 未结 4 772
鱼传尺愫
鱼传尺愫 2020-12-28 09:14

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 authenticat

相关标签:
4条回答
  • 2020-12-28 09:19

    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.

    0 讨论(0)
  • 2020-12-28 09:29

    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.
    0 讨论(0)
  • 2020-12-28 09:42

    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.

    0 讨论(0)
  • 2020-12-28 09:43

    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.

    0 讨论(0)
提交回复
热议问题