One of the most annoying parts of developing for Android is the use of the emulator. I am always using a real device for my development, because that is simply the fastest way to get the app running and it works the best for testing stuff.
Testing your app on a real phone is a must, as there are too many differences between the emulator and the real phone that may cause your app to malfunction. However, there are cases where you cannot use a real phone or need to test on a different version of Android than what you have a device for. Since there’s so many versions of Android, you actually need the emulator to keep costs within reasonable limits.
In this post I want to show you a good trick to make running the Android emulator for some versions of Android a lot faster by using the Intel Hardware Acceleration Manager (HAXM) on Windows 7 or Windows 8.
Note: There’s also a HAXM driver for Mac and Linux, so the stuff I write here will work on those machines too.
Getting the driver
The most important step for you to get started is to get the HAXM driver from the Intel website. Please follow this link to get the software from the Intel website. The version you need depends on the OS, so take a close look at the contents before downloading a driver.
Note: The website says the driver is available for Windows 7, but I tested it on Windows 8 RTM and it will work there aswell. Luckely the new Windows release isn’t that different from Windows 7 in that respect.
After you installed the driver you can check if it is running by invoking the following command in a console window:
sc query intelhaxm
If it say it’s running, you’re good to go for the next step.
Creating a new Virtual Image
The Intel HAX driver will only work for Atom based Android emulator images. This means that while it does drammatically improve the speed of the emulator image, the options are limited. You can either go for an Android ICS (4.0.3) image or an Android Gingerbread image (2.3.3).
To create a new image, start the AVD manager and click the button called New… and choose the OS version you want to emulate.
In the next screen you can give the new image a descriptive name (Mind you, no spaces!). Next select either Android 4.0.3 or 2.3.3 OS target. After you have selected the target, you can choose between Intel Atom (x86) and ARM as the processor architecture.
The rest of the options is pretty straightforward. If you want to store additional data on the phone, provide a size for the SD card. Usually 1 or 2 GB is enough for testing purposes.
Finally you can enter a number of additional options in a list at the bottom of the screen. This list of options influences a number of apsects of the phone, such as GPS support, GPU acceleration and other options.
A pro tip™: Add the GPU emulation option to this list and set it to yes. This will allow the emulator to use your graphics card for accelerating the graphics performance on the emulator. I’ve seen some pretty high speed improvements from this setting on my machine. It’s the sort of setting that makes the difference between a choppy animation and fluent pixel goodness.
Press Create AVD to complete the creation process and away you go!
There’s only one though lingering in my mind. Please give me more Atom images people at Google/Intel!