Yjfox.github.io

Jun Yin's Personal Blog

Follow me onGitHub

Android Google Map V2 API

As for now tons of developer cannot deploy Google Map API on their android emulator. This article is to solve this problem


Step 1:

  • Download SDK, connect with your eclipse or netbeans.
  • Download google play service on SDK, and do same to all of android 4.4.2(latest)
  • Create an android project, copy SDK/extras/google/google-play-services/libproject/google-play-services_lib this folder into your projects' libs folder
  • a) for eclipse: Import the folder mentioned in 1.3(not the sdk's lib folder, but your project's lib folder), then right click your project and choose "android", add this library.
    b) for netbeans: Right click your project and click libs, add this folder(not the sdk's lib folder, but your project's google-play-services_lib lib folder).

Step 2:

  • go to sdk/tools (or probably sdk/platform-tools in windows) in terminal. run command

android update lib-project --path "folder google-play-service's path
in your own project rather than its original one --target android-xx"

sometimes maybe need --target android-xx(xx is up to your emulator, mostly is 19 if you use android 4.4.2)

  • go back to IDE, click "clean and build", it should succeed. It can run on android devices but still doesn't work on emulator

  • download two apk files named: com.google.android.gms.apk and com.android.vending.apk, or your can leave your email by reply, I'll send these two to you ASAP

  • go to sdk/platform-tools in terminal, run command

adb install -r com.google.android.gms.apk/com.android.vending.apk
(make sure these two files are in this directory, otherwise you need type absolute path)

  • if it show failed, and with some information like "FAILED-SHARED-USERS", please follow next step 3, otherwise Congratulation! you made it.

*Step 3:

  • command line:

adb shell chmod 666 /data/system/packages.xml
adb pull /data/system/packages.xml - get the packages.xml

  • modify the packages.xml, delete all content between < shared-user> < /shared-user>
  • command line:

adb push packages.xml /data/system - upload back to android
adb shell rm /data/dalvik-cache/*
adb reboot

  • if you cannot use adb command, please restart adb -

adb kill-server
adb start-server
adb devices - see if your running emulator is showed on screen

  • if feedback is those two apk existed, then uninstall them by

adb uninstall com.google.android.gms/com.android.vending

then install again.

OK, all processes have been introduced. You may ask any question encountered by reply.

end. 2014-02-05

blog comments powered by Disqus