Running Google Maps v2 on the Android emulator

前端 未结 11 1950
一整个雨季
一整个雨季 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:18

    I am able to have my emulator to run my app with Google Map V.2 (with Google Play Service V.4). I followed steps that others suggested with some failures, however I learned from it and somehow make it work. This is how:

    1. First of all: You must have coded your map app. correctly with all the appropriate permissions setup in your metafile XML, and have Google Play Services APK part of your app. To verify this is true, you must run your app on REAL device and know it works with its map there. Then you can proceed to process your emulator as shown below.

    2. Create a new emulator, or use your existing emulator with specs:

      • Target Name = Android 4.1.2
      • API Level = 16
      • CPU = Any. However, I found ARM is much faster/responsive than x86
      • Have enough RAM memory and space MB
    3. Run you emulator (your target emulator must be running!)

    4. Download the following APKs (available via dropbox per 4/2/2013) to your local directory (scan for virus!):

      • com.android.vending.apk, (Google Play Store, v.3.10.9)

      • com.google.android.gms.apk, (Google Play Service, v.2.0.12)

    5. Install these two APK into your running (target) emulator with ADB command:

      DOS/Console Prompt> adb -e install [path-to-APK-file]

      NOTE: Possibly, you have had these APKs installed in your emulator during this trial-error, and need to re-install for some reason. You must uninstall them first by: adb -e uninstall (com.google.android.gms or com.android.vending)

    6. Here, it is where things could get tricky. You think you were done, but when you open your app with Map again, but all you get is an error saying something in the form of: "Google Play services out of date. Requires 2012100 but found 2010110", and may see a button to "Update" Google Play. If this is the case, do NOT attempt to click the update button since it won't do anything. I got this error too, and I resolved it by both of these additional steps:

      • Clean-rebuild-reinstall my app into the emulator
      • Shutdown my emulator and re-start it.
    7. That's it, it works now nicely.

提交回复
热议问题