A Quick Peek at Hardware-Accelerated Android* Emulation, Using Intel® Hardware Accelerated Execution Manager (Intel® HAXM)

Hey Android* app developers, do you ever feel like the Android Emulator in the Android SDK is really slow?  Do you feel forced to test your apps on a real device?  What if no device is at hand when you need it and you really want to test your app on different form factors?  Do you totally hate the emulator waiting times?

Well, enter Intel® HAXM!

Intel® Hardware Accelerated Execution Manager (Intel® HAXM), is a hardware-assisted virtualization engine (hypervisor) that uses Intel® Virtualization Technology (Intel VT) to speed up Android app emulation on a host development machine. Intel HAXM is available in a standalone release.   

The usual way an emulator works is as follows: the whole physical device that you intend to have is created in software, that is, the mainboard of the device, CPU and other pieces of hardware are represented in software. This emulation process is very time consuming.

What if you could directly use the processor in your computer, along with other system hardware, to speed things up?  Efficient virtualization is at the heart of the solution.  Virtualization is the process of creating a wrapper that hides the physical characteristics of the host platform from guest software, such as the apps that you develop.  That wrapper is a “control program” more popularly known today as a hypervisor or virtual machine monitor.  Therefore, from its perspective, the guest software is running directly on the hardware. This means that with Intel HAXM, you can test your app as they run at near normal run-time speeds, making you more productive.   

Without virtualization, creating an Android device in software on your PC would require creating an ARM-based CPU and other associated hardware in software.  The ARM architecture is different from the Intel Architecture (x86) and translating every system call from one architecture to the other can easily take a huge toll on the physical processor, leading to an obvious performance lag.  Intel HAXM is specifically designed to shorten this lag as much as possible so your app behaves more realistically, helping you test your app more quickly.

How does Intel HAXM work?

The Android emulator is based on a modified version of QEMU (short for Quick Emulator) adapted to emulating a smartphone board. The diagram below shows an overview of how the virtualization works. The QEMU-based Android emulator which you can download from the Android SDK Manager already comes with HAXM support. However, you can only make use of HAXM if you install the HAXM driver, also available in the Android SDK Manager (in the Extras section).

Intel HAXM Architecture

Figure 1 Intel HAXM Architecture

In order for the virtualization to work, you need to ensure that the Intel® Virtualization Technology (or Intel® VT) is enabled in the BIOS of your PC. Most Intel processors released after 2005 have support for Intel VT. You may wish to check ark.intel.com to verify if your processor has the necessary capabilities. Next, we need to use an x86-based Android image, which you can download Android SDK Manager. Recall, we need an x86-based Android image because we want to avoid CPU system call translations from a different CPU architecture.

Virtualizing the CPU is a great performance boost (check this link for some benchmark results). However, a mobile device has a GPU as well.

Fortunately, the Android emulator based on QEMU provides GPU virtualization. QEMU is able to provide accelerated graphics support by providing an OpenGL pass-through mechanism allowing the emulated Android operating system to make OpenGL calls that are directly rendered on the host graphics chip.

Finally, you can get maximum performance by leveraging the physical CPU (using Intel HAXM) and the physical GPU. Consult the official hardware acceleration page for configuration details.

You can find help on installing HAXM on Windows here and on Mac here.  In case you encounter troubles installing HAXM, check out our troubleshooting tutorial. If you want to use hardware acceleration to emulate an app which uses Google APIs, check out this article.

If you have problems, which the above troubleshooting link couldn’t resolve, feel free to post your question on our “Android Applications on Intel Architecture” forum.

Give Intel HAXM a try – and have fun!





Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.
Возможность комментирования русскоязычного контента была отключена. Узнать подробнее.