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).
- First create a basic Android project. Follow this tutorial to do this within Visual Studio.
- 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):
- Once HAXM is installed, you can start/stop its service using Windows Service Manager or using the VisualGDB Android settings window:Note 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.
- 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:
- Add the following text to the Application.mk file:
1APP_ABI := x86
- Rebuild your project. You will see the x86 compilation taking place in the log file:
- 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:
- Observe the emulator startup log. It should mention that the acceleration is working properly:
- 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:
- Set a breakpoint inside your native code. Interact with the app so that the breakpoint is triggered:
- You will notice a significant increase in debugger performance compared to the virtual ARM devices. Other aspects of the emulation will remain the same: