Make your Android Virtual Devices (AVD) run fast


Updated: July 19, 2014

If you are developing applications for Android, this tutorial may interest you. Notably, this article will show you how to configure your Android SDK and the underlying operating system for best performance, so that your Android Virtual Devices, acronymed AVD, run fast and respond quickly. This can be crucial during development, as you want to save time on AVD restarts, debugging and suchlike.

I do have one reservation, and that is, the contents of this guide have been tested and written for Windows, with Intel architecture. If you happen to use Linux or AMD processors, you will have to wait a little until I bake successor articles. With that in mind, do follow me please.

Teaser

Obtain Intel x86 Atom System Image

The first thing you will need to do for this to work is to get the x86 image. You can either download it manually, which can be a little tedious, or you can do it through the Android SDK Manager, which is the reasonable way of doing. Naturally, you will have to setup Android SDK, and this also means installing the right version of Java.

Inside the SDK Manager, download a version of the Android image you find suitable for your needs, like for example Kit-Kat (4.4 - API19). You can also go for older versions. Wait until it is installed.

Android x86 download

Downloading image

Install Intel HAXM driver

This is the part where you get a big performance boost. This driver optimizes the Android performance on x86 architecture. You can find in on the official site. Grab and install. Run. And most likely fail.

HAXM failure

The reason for the failure is as explained in the popup. You most likely have the Execute Disable Bit set to, guess, disabled in BIOS/UEFI. Which means that the driver cannot be installed. You will have to reboot, enter the BIOS/UEFI setup and make the correct change. The exact notation will vary from one manufacturer to another, but it will most likely be found under memory management. Set to enable, reboot.

Reinstall HAXM

Now, everything should be fine.

HAXM setup

Create new AVD

This is probably trivial, but then:

Manage AVD

Create new

Create new AVD

Please pay attention to some of the options. The RAM should be set to 768MB or less. You should also configure an SD card so that you don't end up with no memory for your tests. And possible use the host GPU for better performance, regardless.

Test change

Now, start your AVD. If you do not have HAXM installed, you will not see any message when you fire up the virtual device. Moreover, everything will be super slow. Treacle slow, but not when it runs fast, when it runs slow, right.

Starting emulator, no HAXM

If you do have HAXM, lo and behold:

Starting emulator, HAXM loaded

Starting emulator for AVD 'Some name'
emulator:device fd:XXX
HAX is working and emulator runs in fast virt mode

And now you should be able to enjoy your development at approximately 100x speed of what you had previously. Things will loads in seconds rather than minutes. Much like the use of virtualization extensions for the likes of KVM or Xen and such.

AVD running 1 AVD running 2

Conclusion

And we're done here. This is a rather neat tutorial, which teaches you a bit about everything, including managing software through Android SDK, creation of virtual devices not unlike the typical virtual machine setup in popular virtualization software, the use of processor features and extensions to improve performance, and a few more tricks. Well, that brings to a happy end, and some credits to smart people who helped.

Many thanks to Mr. Vova for the tips for this article!

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate