Improving the Performance of the Android Emulator on Windows
This is a collection of tips and tricks I have found that have greatly improved the performance of emulators on windows. When I first loaded the emulator, it took just under 2 minutes to load and get to a point where an app could be started. After making some tweaks, it now takes about 20 seconds.
On the left we have the default ARM setup and on the right we have an x86 emulator setup (at 3x speed):
The three major factors that contributed to the increase:
- Using the x86 emulator instead of the ARM emulator
- Enabling
Use Host GPU
on the virtual device - Ensuring HAX is installed
Using the x86 emulator
To create an x86 emulator, you need to ensure you have downloaded the x86 system image for your android version:
Once that is done, simply create a new emulator using that CPU:
Enabling Use Host GPU
Enabling the host GPU allows your video card to do some of the heavy lifting for display rendering and should give you a good deal of a performance increase. This setting is on the VHD creation dialog:
Enabling HAX
HAX is a hypervisor developed by Intel that was built specifically to improve Android emulation on Intel hardware. You can install this from the Intel website, or run the IntelHaxm executable included with the Android SDK. This can be found at:
extras\intel\Hardware_Accelerated_Execution_Manager
Note that this only works with some intel processors. See the troubleshooting section for more info.
After the install, you can check if the service is working by running sc query intelhaxm
. You should see a state of 4 indicating it is running:
$ sc query intelhaxm
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
Also, when you start your emulator, you should see a message indicating HAX is working:
Starting emulator for AVD 'Nexus-7GPU'
emulator: device fd:924
HAX is working and emulator runs in fast virt mode
Troubleshooting
When trying to set this up, I did run into a few snags and there are some things to check if you are getting error messages.
Make sure your processor supports HAX
You can check if your processor supports HAX on the Intel Ark website. Select your processor and under the Advanced Technologies section, look for the value IntelĀ® Virtualization Technology (VT-x)
and ensure it is set to yes.
Verify VT-x is enabled in the BIOS
If your processor supports VT-x there may be a setting in the BIOS that enables or disables the feature. Verify that this setting is set to enabled.
Disable any other hypervisors
I found that on my Windows 8 installation Hyper-V was installed and this was interfering with HAX. You have to disable the feature (not just disable the services) in order to work around this. To disable the feature, open Programs and Features
, select Turn Windows features on or off
and uncheck Hyper-V
.