Following the steps given in yesterday’s article, I setup an x86 ICS emulator for testing. It’s incredibly fast and I can see it working great for standalone dev, but it was lacking a few things. Specifically,I need to test against the Google API add-on because maps are part of our integration. Here is a list of steps to get the Maps API up and running. Hopefully this will hold us over until we start to see some valid x86 emulators from Google.
Install the x86 ICS image
Follow the guide at TestObject to get the emulator up and running. (The intel HAX driver seems to work instead of the KVM method mentioned for OSX, however I only had luck launching from the AVD manager and not from the CLI) I’ve listed the quickstart method here, if you’d rather compile your own, follow the link to their blog.
0. QUICKSTARTFor those who don’t want to get their hands dirty (this takes several hours), we’ve compiled, bundled and pre-configured a system image for your convenience. Simply follow the 5 steps below and your Android ICS emulator-x86 AVD should be up and running.
1. Download the Precompiled System ImageFirst, download the system-image bundle which can be obtained from our site:
2. Untar the System ImageNext, extract the tar.gz file into your Android SDK folder:
$ tar -zxvf android_ics_x86_goldfish.tar.gz -C ~/<sdk_dir>
3. Enable KVM SupportAdditionally, we have to enable hardware-assisted virtualization to get the most out of Intels Linux kernel. See Intels guide  for a more detailed explanation.
$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
Next, we have to ensure that our current user is added to the groups kvm and libvirtd.
$ sudo adduser <your_user_name> kvm
$ sudo adduser <your_user_name> libvirtd
Finally, verify that KVM support is enabled with the following command.
$ sudo virsh -c qemu:///system list
Your screen will paint the following below if successful:
Id Name State
4. Create a x86 AVDNow open the AVD manager and create a new AVD based on the x86 system-image.
First, check that you’ve installed the Android 4.0.3 (API 15) SDK Platform and that the newly added system-image shows up as “Intel x86 Atom System Image”. Next, to create a new AVD we perform the following steps:
- Click on “Tools”, “Manage AVDs” and “New..”
- Name the AVD “x86_4_0_3”
- Select “Android 4.0.3 - API Level 15” as Target
- Choose “Intel Atom (x86)” as CPU/ABI
- Click “Create AVD”
5. Run the x86 Image from CLIFinally, we fire up the x86 emulator with enabled KVM acceleration.
$ ~/<sdk_dir>/tools/emulator-x86 -avd x86_4_0_3 \
-kernel ~/<sdk_dir>/system-images/android-15/x86/kernel-qemu \
-qemu -m 1024 -enable-kvm
Install the Google API addons into the image
- In Android Virtual Device Manager create an AVD with target “Android 4.0.3 - API Level 15”
$ emulator-x86 -avd name_of_avd$ adb pull /system/etc/permissions/com.google.android.maps.xml$ adb pull /system/framework/com.google.android.maps.jar
- (optional) Remove the create AVD in Android Virtual Device Manager
- In Android Virtual Device Manager create an AVD with target “Intel Atom x86 - API Level 15”
$ emulator-x86 -avd name_of_avd$ adb remount rw$ adb push com.google.android.maps.xml /system/etc/permissions$ adb push com.google.android.maps.jar /system/framework
- Download mkfs.yaffs2.x86
$ adb push mkfs.yaffs2.x86 /data$ adb shell ‘chmod 777 /data/mkfs.yaffs2.x86”$ adb shell ‘/data/mkfs.yaffs2.x86 /system /data/system.img’$ adb pull /data/system.img
- Copy system.img into AVD directory
- Edit the AVD
- Add a new hardware flag for GPU emulation and set the value to “yes”
- Reboot emulator
- If you receive an out of memory error, start the AVD with the additional flag -partion-size 1024
- If you have problems launching the AVD from the command line, use the AVD manager or Eclipse. Using Eclipse you can specify the additional argument listed in “1.”