Guide: Android Emulator Speed-Up and Google Map V2:

Today I want to talk about the Android AVD – Android Virtual Device, or as
everyone call it the Emulator. I am developing for the Android Platform for about a
year now and only recently come to my ears that this emulator can be Accelerated on
Processors that support Virtual Acceleration. So I have looked at my Lenovo G580 specs,
and luckily the Core I3 sierras supports it.

I have became really interested to know is there really a big difference between
an accelerated machine and one that is not, because every single person who develops for
Android know how slow is the emulator. So I Goggled it and found the following page:
Intel® HAXM – Hardware Accelerated Execution Manager.

There is a great explanation there for what you should do in order to download
and install the HAXM. and how you can turn it on and off and I have to tell the
process of installing this is nothing compare to what you are getting back.
The AVD runs almost fluently like a real device. I was shocked that I didn’t discovered
this earlier. That would save me a lot of nerves while dealing with the painfully slow Android
emulator.

So for every one that develops for Android and going nuts for waiting a couple of second
for every action you make on the emulator I am totally recommending to spend 15 minutes,
find out if you machine support Hardware Acceleration and install the manager in order
to the get rid of this annoying problem.

Last thing if you know that you machine support Hardware Acceleration and still when you
try to install it you get a message that is not support, most likely you need to enable it from
the Bios of you machine.

Now that we covered Hardware Acceleration I want to talk about Google Map V2 support
in AVD.

NOTE: A quick but a very important note, from a further check I made this will work only if you are using google-play-service lib revision #4 in your application (and workspace). If you have already updated google-play-services using the SDK Manager to the latest version (Currently: revision #6) you will receive an error telling you that you that the google-play-services used by your application is too old and needs to be updated:

Google Play services out of date. Requires 3025100 but found 2012110 .

in order to make this guide work you can remove the new google-play-service library from you workspace and download revision #4 from the following link. After downloading reference this project instead of the newer one and then try to implement this guide.

Anyone that tried to develop an application that uses Google’s great new API
for maps has encountered the following message instead of a map:

get google play services

Pressing the “Get Google Play Services” button won’t do you any good and most likely
will crash your application. After some time that I was searching for a solution I
have stumbled on few post on Stack Overflow where people managed to get Google Maps
running by installing the apk of Google Services that are relevant for Google Maps.
Did the same and it works, now I am able to develop my map application even
without an Android device always by my side.

So the steps to enable Google Maps API V2 in the emulator are as following:

1. You need to download 2 apk files: com.android.vending.apk and com.google.android.gms.apk

2. Open eclipse and the AVD Manager and create an AVD with the following configuration:

img

3. Start the AVD and wait for it to finish booting, next open you command prompt and install
both apk’s using the “adb install” command. for example:

C:\Users\<your user name>\Downloads\adb install com.android.vending.apk

you should receive “SUCCESS” message at the end of the installation process (that may take some time).

4. When you finish installing both apk files, close the AVD and reopen it. Now you should see a
map in your application when you use the AVD instead of this annoying message.

That’s it for today, Enjoy.

44 Responses to this entry

  • suresh vairamuthu Says:

    Hi Emil
    I think you are the one to post question that on running app with map it shows only zoom controls and no map, did u solve it…
    coz im stuck with the same problem showing error failed to find provider.. Please let me know if u have solved and what did u do to get rid of that error..
    thank you

    Posted on April 12th, 2013 at 9:14 am Reply | Quote
  • Emil Adjiev Says:

    There are several reasons you could encounter this problem, if you opened a question on SO.
    post here a link.

    Posted on April 12th, 2013 at 9:59 am Reply | Quote
  • Rupesh Says:

    Still I am Getting Exception of Update Google Play Services on emulator of specified configuration in your tutor .

    Posted on April 15th, 2013 at 2:36 pm Reply | Quote
  • Nguyen Khoi Says:

    Hi Emil,
    Thank for your tutorial, I’ve done it step by step, but I still have a problem. It shows this message :”This app won’t run unless you update Google Play Services”. I’m sure that I have latest Google Play Services version. I don’t know how to fix it. Very thanks if you could give me a direction.

    Posted on April 18th, 2013 at 6:15 am Reply | Quote
  • ExSco Says:

    can u Give me another solution Emil Adjiev cause this one don’t work , when i put “adb install com.android.vending.apk”

    Posted on April 19th, 2013 at 2:57 am Reply | Quote
  • Emil Adjiev Says:

    @Rupesh, @Nguyen Khoi, @ExSco please read the following newly added note:
    A quick but a very important note, from a further check I made this will work only if you are using google-play-service lib revision #4 in your application (and workspace). If you have already updated google-play-services using the SDK Manager to the latest version (Currently: revision #6) you will receive an error telling you that you that the google-play-services used by your application is to old and need to be updated. in order to make this guide work you can remove the new google-play-service library from you workspace and download revision #4 from the following link. After downloading reference this project instead of the newer one and then try to implement this guide.

    Posted on April 22nd, 2013 at 11:09 am Reply | Quote
  • Minh Nhat Says:

    Thanks Emil! It work fine now :D

    Posted on May 4th, 2013 at 7:44 pm Reply | Quote
  • ExSco Says:

    Yép , it work’s with that google api =) thx bro

    Posted on May 4th, 2013 at 9:53 pm Reply | Quote
  • Nguyen Khoi Says:

    Hi Emil.

    I replace my Google Play Service Revision 4 instead of 6. And now it’s show a blank screen. I’ve made a question on SO
    Link : http://stackoverflow.com/questions/16478801/google-map-v2-on-android-emulator
    Thank for your help :)

    Posted on May 10th, 2013 at 12:32 pm Reply | Quote
  • Mala Widiyanto Says:

    Thanks Emil this is work for me,
    but how can make the android emulator running fast?
    afetr I installed HAXM, must I install the emulator from intel or not? like “Android* 4.2 (Jelly Bean) x86 Emulator System Image”, etc ?

    Posted on May 10th, 2013 at 4:40 pm Reply | Quote
  • Emil Adjiev Says:

    @Mala Widiyanto from my experience, Emulator acceleration would work without the image as well but for me, when I didn’t used it I had encountered strange behavior from the Emulator after some time. So the image is recommended.

    Posted on May 10th, 2013 at 9:35 pm Reply | Quote
  • teo Says:

    It’s only for machines running Windows?
    I haven’t find anything about linux.

    Posted on May 20th, 2013 at 6:20 pm Reply | Quote
  • Emil Adjiev Says:

    @teo As far as I know this solution works only on Windows environment.
    I’m not familiar with a Linux solution as I’m not using Linux.

    Posted on May 21st, 2013 at 2:50 am Reply | Quote
  • Nani Says:

    Hello Emil, I just wanna ask about creating AVD. Is it ok to set the AVD to Android 4.1.2 instead of Google APIs (Google Inc.)?

    Posted on June 2nd, 2013 at 11:36 am Reply | Quote
  • Emil Adjiev Says:

    @Nani as you can see from the posted screen shot the AVD image should be the one of Android (Android 4.1.2) and not the Google API one. If you use Google API it wont work.

    Posted on June 2nd, 2013 at 12:18 pm Reply | Quote
  • Nani Says:

    @Emil Adjiev but if i want to run the apps, eclipse not allow me to run in emulator that set of Android X.X… eclipse only allow to run in Google APIs

    Posted on June 3rd, 2013 at 12:34 pm Reply | Quote
  • Nick Says:

    HI Emil,

    I replace my google service revision 6 with revision 4 and now it shows the error “ClassNotFoundException” “com.google.android.gms.MapFragment”.
    I referenced revision 4 library same as revision 6 but it shows this error only in revision 4.

    Thanx in advance.

    Posted on June 5th, 2013 at 2:09 pm Reply | Quote
  • Emil Adjiev Says:

    @Nick Hi, “com.google.android.gms.MapFragment” is part of the google-play-services library. If it’s can’t be found then there is still some problem with your referencing to this project. try to move this library project to another location (where it’s path would be shorter.. ) and then reference it again.

    Posted on June 5th, 2013 at 2:18 pm Reply | Quote
  • ismail Says:

    if you are using google-play services version 7 then you should download and install folowing files (otherwise it will not work on emulator):

    https://docs.google.com/file/d/0B38ecRHd_W4aSDJfdGJHOTN3UEU/edit?usp=sharing (com.google.android.gms-(3.1.36).apk)

    http://www.androidfilehost.com/?fid=22946563261204178 (com.android.vending-4.1.6.apk)

    Posted on June 21st, 2013 at 4:09 pm Reply | Quote
  • Emil Adjiev Says:

    Great info @ismail , I will check this out, Thanks.

    Posted on June 23rd, 2013 at 9:23 pm Reply | Quote
  • Dieter Says:

    android emulator error Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE] when installing gms

    Posted on June 27th, 2013 at 5:04 am Reply | Quote
  • whiteknight Says:

    Ismail – tried your approach. It works for me with Google Play Services 7. Thanks !!

    Posted on June 28th, 2013 at 9:35 pm Reply | Quote
  • Emil Adjiev Says:

    @Dieter you can check the set of files provided by Ismail, and, two comment before, and let us know how it works for you. Thanks.

    Posted on June 30th, 2013 at 11:02 am Reply | Quote
  • Randika Says:

    Hi,
    it’s a nice tutorial.
    Can I know where did you get those two APK files?
    I so some official website which gives a list of APK files to be downloaded for developers,But I’m unable to find out the link.
    Thanks

    Posted on July 12th, 2013 at 3:53 pm Reply | Quote
  • Emil Adjiev Says:

    @Randika this way to run Google Maps API V2 on the emulator is unofficial and it isn’t supported by Google, so there is no an official website where you can download other set of APK files. But you could can a comment here by Ismail for another set of files for a new google-play services version.

    Posted on July 16th, 2013 at 3:33 am Reply | Quote
  • arshmeet Says:

    hey, i tried installing these files in cmd. i have google play services 8 and on giving the command adb install com.android.vending.apk i get the message saying adb is not recognised as an internal or external command, operable program or batch file.

    Posted on July 19th, 2013 at 11:32 pm Reply | Quote
  • Emil Adjiev Says:

    @arshmeet the message you receive indicates that the system can’t find the adb command. This means that you have to fix the “system variable” HOME and add your SDK path to it.

    Posted on July 21st, 2013 at 2:31 am Reply | Quote
  • sourabh Says:

    @Emil Adjiev thanks for this tutorial It worked for me. Thankyou very much :)

    Posted on July 26th, 2013 at 8:08 am Reply | Quote
  • Maria Says:

    I cant install the adk files. failure file already exist. now i am using eclipse and my emulator said that I have to update google play services. what can i do?

    Posted on August 16th, 2013 at 6:45 am Reply | Quote
  • Emil Adjiev Says:

    @Maria you can try to install a different set of files that is presented here in the comments. Please note that if you are using the latest google-play-service library this guide won’t work.

    Posted on August 18th, 2013 at 11:19 am Reply | Quote
  • Shakeel Says:

    anyone can give me these files for version 10… i will really appreciate it…. thanks in advance…..

    Posted on August 26th, 2013 at 8:33 pm Reply | Quote
  • CesarEC Says:

    i´am using google-play services version 7 and i have the same problem, i need help, please

    Posted on October 4th, 2013 at 11:58 pm Reply | Quote
  • Emil Adjiev Says:

    @CesarEC Hi, For google-play-service version 7, there is a comment here written by Ismail that has the files you need.

    Posted on October 7th, 2013 at 10:32 am Reply | Quote
  • Govind Says:

    Thank you so much Emil finally it works for me too.
    I also observe one thing when i import google-play-service library u mentioned. An red exclamation mark appear in front of project folder. Which i resolved by checking setting in build path.
    Thanks :)

    Posted on November 18th, 2013 at 10:14 am Reply | Quote
  • Tanya Says:

    Dear Emil

    I am stuck with a weird problem. I am trying to import OpenDataKit Collect code into Eclipse. This code uses google play services so I installed them through SDK. But when I try to import the google play library file, it gives errors like the ones below. I understand that I should run the eclipse as Administrator and then try and make changes. But running as administrator does not show any projects in the package explorer. I accidently deleted the lib file and and had a copy of google play services library bu chance. So using that. Please help .

    Failed to create BuildConfig class Copy of google-play-services_lib

    The project was not built due to “Could not delete ‘/Copy of google-play-services_lib/bin/classes/android’.”. Fix the problem, then try refreshing this project and building it since it may be inconsistent

    The project cannot be built until build path errors are resolved

    Project ‘ODK Collect’ is missing required Java project: ‘google-play-services_lib’

    Posted on November 24th, 2013 at 1:05 pm Reply | Quote
  • Emil Adjiev Says:

    @Tanya Hey, I don’t really understand you problem to the bottom of it, I have never used OpenDataKit, but it looks like the problem is not related to this library. It looks like the problem is: “Could not delete ‘/Copy of google-play-services_lib/bin/classes/android’”, If I were you I would try to remove google-play-services using the SDK Manager, and try to redownload it again, maybe move it to other location in your machine to create a new path to it. Then try to reference it again.

    If this doesn’t help you, you can post a question on SO and post here a link, I will try to help you there.

    Posted on November 25th, 2013 at 12:30 pm Reply | Quote
  • Tanya Says:

    Thanks Il try that

    Posted on November 25th, 2013 at 3:13 pm Reply | Quote
  • Alessio Says:

    Hi Emil!
    I followed all your tutorials on maps v2 (including the one to get the API key) and this to see the map on the emulator, but nothing! I installed the two packages com.android.vending.apk and com.google.android.gms.apk on an emulated device wrong, when I tried to do it on another gives me this error:
    C: \ Users \ **** \ Downloads> adb install-r com.android.vending.apk
    82 KB / s (6158861 bytes in 73.149s)
             pkg: / data / local / tmp / com.android.vending.apk
    Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

    (without-r fails as well)
    how can I do?
    fails even if I try to unistall

    Posted on December 11th, 2013 at 11:28 am Reply | Quote
  • Emil Adjiev Says:

    @Alessio Hey, Have you followed the comments? this solution will work only for revision 4 of the google-play-services library. In the comments there are files that will work with revision 7. For the time of writing those lines the last revision is 13. So those files won’t work with it.

    Posted on December 11th, 2013 at 11:44 am Reply | Quote
  • Alessio Says:

    I’ve only read the initial ones, sorry! :)
    thanks

    Posted on December 11th, 2013 at 11:56 am Reply | Quote
  • addisu Says:

    Very Important page! Glad to use it.

    Posted on December 24th, 2013 at 8:54 am Reply | Quote
  • Serj Says:

    No matter what google play service library (and the associated apk files of the maps and store) I import I still get the same error : AndroidManifest.xml does not have the right value. Expected 4132500…
    Tried it with several avd types and still come up with nothing.

    Any idea how to solve this ?

    Posted on February 11th, 2014 at 2:21 am Reply | Quote
  • Emil Adjiev Says:

    @Serj Hey, you could try to add this to your Manifest file:

    [java]
    <meta-data
    android:name="com.google.android.gms.version"
    android:value= "4132500" />
    [/java]

    right next to the maps api key meta-data tag.

    Posted on February 11th, 2014 at 3:53 pm Reply | Quote
  • Serj Says:

    Tried that already :) Still nothing

    Posted on February 11th, 2014 at 4:44 pm Reply | Quote

Leave a comment