Archive for February, 2013

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.

February 11, 2013Emil Adjiev 45 Comments »
FILED UNDER :Guide , Guide - Android Development