There are three ways to speed up the emulator:
- Using emulator snapshots for fast startup
- Using x86 hardware acceleration on Android images ver. 10 and 15+ (2.3.3 and 4.0.2+)
- Using GPU OpenGL acceleration for interface rendering on images ver 14+ (Android 4.x)
1. Emulator snapshots
One of the most jarring annoyances with the emulator is the slow startup time, especially when using newer OS images. Even a machine with 16GB of RAM and a fast SSD can take several minutes to boot Android in the emulator.
Google has provided the solution for this problem in form of “Snapshots” - functionality very similar to VirtualBox snapshot functionality or desktop OS hibernation. After first boot the full emulator state is dumped to hard drive and on next startup the state gets read back to the memory without going through time-consuming Android startup procedure. This shortens boot time from several minutes to a couple of seconds.
To use snapshot functionality, you need to enable it in the AVD emulator settings when creating (or editing) a new emulator.
2. x86 hardware acceleration
Android usually runs on ARM architecture, which is very different from x86 architecture of desktop PCs and the emulator has to translate all OS instructions from ARM to x86 for Android to run. You can avoid that by using an Intel x86 image of Android with Intel HAXM accelerator.
On Windows and OS X you need to first install Intel HAXM execution manager, which will speed up x86 emulator execution:
- Download HAXM installer with Android SDK manager by selecting Extras -> Intel Hardware Acceleration Execution Manager
- Install HAXM by running IntelHAXM.exe (Windows) or IntelHAXM.dmg (OS X) from extras/Intel/Hardware_Accelerated_Execution_Manager folder. You can find “extras” directory in your Android SDK directory.
- Android 4.1 (API 16) -> Intel x86 Atom System Image
- Android 4.0.3 (API 15) -> Intel x86 Atom System Image
- Android 2.3.3 (API 10) -> Intel x86 Atom System Image
Note: You MUST select an Android image, not Google APIs image to get a choice of Intel Atom ABI.
If you’re using Windows or OS X you can now start the accelerated emulator.
Linux users have to make an extra step: because there’s no HAXM module for Linux, Linux users have to add
-qemu -m 512 -enable-kvm
to startup parameters of the emulator. This can be done in Eclipse when running your app (in Run configuration… dialog).
3. OpenGL acceleration for interface
Android Emulator renders everything in software without help of GPU which is the main cause of terrible performance – especially when emulating tablets. This can be fixed by using OpenGL for all graphics in the emulator on Android 4.0+.
GPU Acceleration is off by default and has to be enabled when creating an emulator by adding a GPU Emulation setting set to yes.
NOTE: Snapshots won’t work on emulators with GPU emulation enabled.
Using Intel image with GPU acceleration or Android 4.x+ should make the emulator fast enough to test your app even on 720p+ tablets.