2012-03-27

How to use Google Maps API in Android emulator SDK version 17


  1. In Android Virtual Device Manager create an AVD with target "Android 2.3.3 - API Level 10" 
  2. emulator -avd name_of_avd
  3. adb pull /system/etc/permissions/com.google.android.maps.xml
  4. adb pull /system/framework/com.google.android.maps.jar
  5. (optional) Remove the create AVD in Android Virtual Device Manager
  6. In Android Virtual Device Manager create an AVD with target "Intel Atom x86 system Image (Intel Corporation) - API Level 10" 
  7. emulator -avd name_of_avd
  8. adb remount rw
  9. adb push com.google.android.maps.xml /system/etc/permissions
  10. adb push com.google.android.maps.jar /system/framework
  11. Download mkfs.yaffs2.x86
  12. adb push mkfs.yaffs2.x86 /data
  13. adb shell
  14. cd /data
  15. chmod 777 mkfs.yaffs2.x86
  16. ./mkfs.yaffs2.x86 /system system.img
  17. exit
  18. adb pull /data/system.img (...be patient)
  19. Copy system.img into avd directory
  20. Reboot emulator

29 comments:

  1. I have done all of this, but when I try to uploadd app with Google Maps support, I get: Installation error: INSTALL_FAILED_CONTAINER_ERROR.

    ReplyDelete
    Replies
    1. Try add param -partition-size 1024 for start emulator
      emulator -avd "AVD NAME" -partition-size 1024

      Delete
    2. Thanks. This solved my problem.

      Delete
    3. Or:
      emulator -avd name_of_new_x86_avd
      adb remount rw
      adb shell
      cd /data
      rm mkfs.yaffs2.x86
      rm system.img
      exit

      Delete
  2. Excellent! Thank you very much.

    ReplyDelete
  3. Your solution worked for me i was able use Google Map API in Intel Atom x86 API 10.

    I also wanted to work it for Intel Atom x86 API 15. But it gave me error when i performed

    adb push com.google.android.maps.xml /system/etc/permissions

    failed to copy 'com.google.android.maps.xml' to '/system/etc/permissions/com.google.android.maps.xml': Out of memory

    ReplyDelete
  4. Solved by using -partition-size 512 with emulator

    emulator -avd Atom -partition-size 512

    ReplyDelete
  5. # ./mkfs.yaffs2.x86 /fsys system.img
    ./mkfs.yaffs2.x86 /fsys system.img
    ./mkfs.yaffs2.x86: 1: Syntax error: "(" unexpected

    ... is the online version changed?

    ReplyDelete
    Replies
    1. Did you ever find a solution to this? I get the same error.

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Reverse geocoding on an emulator configured as described on this blog always seems to return an empty list. But the same app on an Android 4.0.3/ARM/Google APIs emulator returns addresses correctly.

    Any ideas as to what the problem might be?

    Perhaps a reverse geocoding permission file that needs to be pulled/pushed?

    ReplyDelete
  8. Brilliant! You can do the same if you are missing the USB accessory library.

    Thanks a million!

    ReplyDelete
  9. worked great, thanks the help in the comments as well.

    ReplyDelete
  10. Tried this and the steps worked well for maps. Any idea where the Google account authenticator lives? This would be the piece that allows AccountManager to understand com.google account types.

    ReplyDelete
  11. Hi.
    I've just followed this tutorial but the system doesn't start. It's blocked on "Android" splash screen

    ReplyDelete
  12. Trying with API 15, black screen while booting with the new system.img, sometimes GLES errors in the console, adb doesn't connect.

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Trying with API 16. I get the black screen while booting, and it's stuck on the Android splash screen.

    ReplyDelete
  15. Getting error!!

    root@android:/data # ./mkfs.yaffs2.x86 /system system.img
    /system/bin/sh: ./mkfs.yaffs2.x86: not executable: magic 7F45

    ReplyDelete
  16. hey everybody ... the new SDK Tools v21 seems to break this hack. I've created new emulators, and they begin the bootup process, say haxm enabled, and then stop with a blank screen.

    has anybody had luck working this with the new SDK Tools version?

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. btw, if you are using ARM emulator, remember to use mkfs.yaffs2.arm instead of x86. You can download mkfs.yaffs2.arm from the same google group's download page of mkfs.yaffs2.x86.

    ReplyDelete
  19. I had the same problem with system stucking on android screen and i did the same process but change the default internal storage from 200 to 512MB and after it worked fine, thank you!

    ReplyDelete
  20. Does it work with Maps API v2 ? Cause when I launch my MapsFragment I get a GooglePlayServiceNotAvailableException :-/ Any idea ?

    ReplyDelete