avp::ptr weblog

Everything that is in our mind.

How to set up a fast emulator for Android on Linux?

without comments

This article describes how to setup a new emulator which allows to install apps which use Google Play Services.

Recently, Android 4.3 (API level 18) has been published. As former releases it contains system images for ARM and Intel Atom (x86). When creating an emulator via the Android Virtual Device Manager one can choose to target either the “plain” API level or include Google APIs. The “plain” configuration can benefit from both hardware acceleration options (ARM and  Intel Atom). Running such a virtual device is quite comfortable as it behaves similar to a hardware device. The Google API targets however do not allow to use Intel Atom architecture.

Android Virtual Device

This makes it highly uncomfortable to test any application which uses the Google Maps v2 API which is shipped with Google Play Services. StackOverflow has a bunch of discussion on topics around the emulator.

Now, I stumbled into an alternative: the Genymotion emulator. It is based on AndroidVM, an opensource project. The emulator runs on Mac, Windows and Linux. I use VirtualBox on Ubuntu to run it. It is not too hard to set up the software:

  1. Download and install VirtualBox. I used the ppa:debfx/virtualbox to get the latest version.
  2. Sign up for a free account at the Genymotion website
  3. Download and install the emulator for Linux. You need to execute the genymotion-x.y.z_x64.bin file. It will extract its content and then you can run the emulator via ./genymotion/genymotion
    If you happen to have problem with VirtualBox it might help to reload the kernel modules while Genymotion is running. This can be done via sudo /etc/init.d/virtualbox force-reload as slightly different described on their website.
  4. When the emulator has started first configure the Android SDK path
  5. Next download one of their images. I have chosen the one named “Galaxy S4 HTC One Xperia Z – 4.2.2 – with Google Apps – API 17 – 1080×1920”
  6. Run the image and enjoy the speed …

If you need to install a recent .apk you can use the Chrome extension APK Downloader Chrome Extension by Lekensteyn which simple download the .apk from Google Play Store.
Otherwise I recommend to pull them from other images of the SDK in case you do not own a rooted device. All you need is to know the correct path. The following command show how to get the .apk for Google Play Services, Google Play Store and Google Maps.

adb -d pull /data/app/com.google.android.gms-2.apk
adb -d pull /data/app/com.android.vending-2.apk
adb -d pull /data/app/com.google.android.apps.maps-2.apk

An alternative source is to download a Google Apps package. They are used for Android ROMs and can be found in the forum of xdadevelopers. Of course there are .apk downloads on StackOverflow but they are outdated mostly.
To install an .apk having only one emulator running run the following command (example for Google Play Services):

adb -e install com.google.android.gms-2.apk

Here are some screenshots of the running emulator:

Google Maps v2 start screenGoogle Maps v2 viewGoogle Maps version 7.1.0

Google Play Services version 3.2.25Google Play Store version 4.3.11

I like to refer to the following pages for more information:

Written by tobi

September 12th, 2013 at 12:35 am

Leave a Reply