Accelerating your Android simulation using Intel HAXM

This tutorial shows how to significantly improve the performance of your virtual Android device by using hardware virtualization on an Intel CPU provided by the Intel Hardware Execution Manager (HAXM).

  1. First create a basic Android project. Follow this tutorial to do this within Visual Studio.
  2. Download and install Intel HAXM. If you are using VisualGDB, this can be done using a shortcut in the Android Settings dialog (Android->Setup SDK/NDK locations):01-installhaxm
  3. Once HAXM is installed, you can start/stop its service using Windows Service Manager or using the VisualGDB Android settings window:02-haxminstalledNote that the HAXM service reserves certain amount of RAM while running. It is recommended to stop it when you don’t need it and start it again once you start your Android emulator.
  4. HAXM will only accelerate virtual Android devices that are based on the x86 platform. It won’t work with ARM
    devices. To configure your project to use the x86 platform
    please create an Application.mk file inside the jni directory:03-appmk
  5. Add the following text to the Application.mk file:
    APP_ABI := x86
  6. Rebuild your project. You will see the x86 compilation taking place in the log file: 04-abi
  7. Now we will create a new virtual Android device accelerated by HAXM. Open AVD Manager and click “New…”. Select “Galaxy Nexus” as the device and “Intel Atom (x86)” as the CPU: 05-newavd
  8. Observe the emulator startup log. It should mention that the acceleration is working properly:06-haxworking
  9. You will notice how fast the emulated device starts up. Go back to Visual Studio and press F5 to launch your project. VisualGDB will setup the debugging session automatically:07-deploy
  10. Set a breakpoint inside your native code. Interact with the app so that the breakpoint is triggered:08-breakpoint
  11. You will notice a significant increase in debugger performance compared to the virtual ARM devices. Other aspects of the emulation will remain the same:09-emulator