Run your Android apps in highspeed on the emulator

<p>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. </p> <p>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.</p> <p>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. </p><!--more--><p><strong>Note: </strong>There's also a HAXM driver for Mac and Linux, so the stuff I write here will work on those machines too.</p> <h2>Getting the driver</h2> <p>The most important step for you to get started is to get the HAXM driver from the Intel website. Please <a href="http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/" target="_blank">follow this link</a> 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.</p> <p><strong>Note:</strong> 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.</p> <p>After you installed the driver you can check if it is running by invoking the following command in a console window:</p>

1
sc query intelhaxm

<p> If it say it's running, you're good to go for the next step.</p> <h2>Creating a new Virtual Image</h2> <p>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). </p> <p>To create a new image, start the AVD manager and click the button called <em>New</em> and choose the OS version you want to emulate. </p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/08/image.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/08/image_thumb.png" width="255" height="405"></a></p> <p>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. </p> <p>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. </p> <p>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.</p> <p>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.</p> <p>Press <em>Create AVD</em> to complete the creation process and away you go!</p> <h2>Final thoughts</h2> <p>There's only one though lingering in my mind. Please give me more Atom images people at Google/Intel!</p>