Running Google Maps v2 on the Android emulator

前端 未结 11 1629
一整个雨季
一整个雨季 2020-11-22 10:32

I\'ve tried to implement Google Maps v2 in my Android application, but unfortunately instead of maps I get this message:

相关标签:
11条回答
  • 2020-11-22 11:19

    Please try the following. It was successfully for me.

    Steps:

    1. Create a new emulator with this configuration: AVD configuration

    2. Start the emulator and install the following APK files: GoogleLoginService.apk, GoogleServicesFramework.apk, and Phonesky.apk. You can do this with the following commands:

      adb shell mount -o remount,yourAvdName -t yaffs2 /dev/block/mtdblock0 /system
      adb shell chmod 777 /system/app
      adb push GoogleLoginService.apk /system/app/
      adb push GoogleServicesFramework.apk /system/app/
      adb push Phonesky.apk /system/app/
      

      Links for APKs:

      1. GoogleLoginService.apk
      2. GoogleServicesFramework.apk
      3. Phonesky.apk AKA Google Play Store, v.3.5.16
      4. Google Maps, v.6.14.1
      5. Google Play services, v.2.0.10
    3. Install Google Play services and Google Maps in the emulator

      adb install com.google.android.apps.maps-1.apk
      adb install com.google.android.gms-2.apk
      
    4. Download Google Play Service revision 4 from this link and extra to folder sdkmanager->extra->google play service.
    5. Import google-play-services_lib from androidsdk\extras\google\google_play_services.
    6. Create a new project and reference the above project as a library project.
    7. Run the project.
    0 讨论(0)
  • Google has updated the Virtual Device targeting API 23. It now comes with Google Play Services 9.0.80. So if you are using Google Maps API V 2.0 (I'm using play-services-maps:9.0.0 and play-services-location.9.0.0) no workaround necessary. It just works!

    0 讨论(0)
  • 2020-11-22 11:27

    I have already replied to this question in an answer to Stack Overflow question Trouble using Google sign-in button in emulator. It only works for Android 4.2.2, but lets you use the "Intel Atom (x86)" in AVD.

    I think that it is easy to make it work for other versions of Android. Just find the correct files.

    0 讨论(0)
  • 2020-11-22 11:28

    I recommend using the emulator by Genymotion instead of Google's emulators. It launches way faster and responds almost in real-time. It also supports Google Play Services and therefore Google Maps.

    Google Maps on Genymotion

    Give it a try! Here is a blog post which helps you setting up the emulator.

    • How to set up a fast emulator for Android on Linux?
    0 讨论(0)
  • 2020-11-22 11:28

    You need to try on an emulator with the Google API's version. Each platform has two versions, Android and Android+Google APIs. Ensure that when you create the AVD, you select the Google APIs version on target field.

    And the page Ensure Devices Have the Google Play services APK can be also helpful.

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