Android emulator is very famous for its performance. It’s very, very, very notoriously… slow. If you debug your app with Android emulator, it get more extremely slower. This performance problem stems from the fact that Android OS is written for ARM processor (not for Intel/AMD processor or let’s say not for computer processor). Therefore when we get our apps run on Android emulator (which is running on Intel/AMD processor), every assembly code row has to be emulated. A run-time binary translation will happen to translate every assembly code of development machine to device machine. And that point slows down everything.
Even that we can use our real devices for debugging and developing which promise a better performance and save us a lot of time, we’ll face the problem again when we want to test our apps with different resolutions and screen sizes devices. Testing on multiple real devices is definitely a ‘must’ when writing apps for Android, but if the emulator is good enough, we can test it with many test cases in emulator before pushing to the test apartment.
The Android emulator is shipped in Android SDK as default. You can find it under folder ‘tools’ of SDK (%USERPROFILE%\android-sdks\tools). With the emulator, you have an opportunity to write apps without owning a real device. However, if you start the emulator, you’ll recognize something wrong here. It can take up to 5 minutes just for starting an AVD (Android Virtual Device) and when you debug your apps, you’ll see how slow it is to jump from current code row to next code row.
Because of annoyed problem, in this post, I would like to give you a tip to speed up your emulator.
The tip works only if you’re using a computer with Intel processor having Intel Virtualization Technology. You need to check in your BIOS settings if Intel Virtualization Technology is enabled. Enable it, if it’s in off mode.
2. Install Intel Hardware Accelerated Execution Manager
The 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 machine. In combination with Android x86 emulator images provided by Intel and the official Android SDK Manager, HAXM allows for faster Android emulation on Intel VT enabled systems (From Intel)
Let’s follow this URL
choose installation for your OS and install it.
I let everything as default during the installation. That means 2GB RAM for Intel HAXM, you can adjust the amount of RAM according to your resources. Please note that reserving a large memory for Intel HAXM can cause the other processes run slowly.
After installation finishes, you can check if installation works by giving in console the following command sc query intelhaxm. If you see the STATE is RUNNING, that means installation is successful.
3. Install Intel Atom x86 Image
– Start Android SDK Manager (from your IDE or directly under %USERPROFILE%\android-sdks\SDK Manager.exe)
– Be sure that under Extras, the Intel x86 Emulator Accelerator (HAXM) is installed
– Be sure that under Android x.x.x (API xx) (the Android version which you want your AVD running on), the Intel x86 Atom System Image is installed.
– For example, in my case, I would like to have an AVD with Android 4.0.3, my settings should be like following image.
4. Create AVD
– Start AVD Manager (from your IDE or directly under %USERPROFILE%\android-sdks\AVD Manager.exe)
– The recommended settings for AVD are in image below. Important is the CPU/ABI should be set as Intel Atom (x86) and the option Use Host GPU is checked for speeding up rendering process.
– When you start your AVD, if you see the message HAX is working and emulator runs in fast virt mode, that means you have all settings correct.
Now start your AVD and enjoy a ‘fast’ Android emulator ever seen. :).
If you get this error during installation of Intel Hardware Accelerated Execution Manager
This computer does not support Intel Virtualization Technology (VT-x). HAXM cannot be installed. Please refer to the Intel HAXM documentation for more information
Microsoft Hyper V can be the cause of error. If you have Microsoft Hyper V enabled, Intel HAXM can’t be installed on your computer. So if you don’t use Microsoft Hyper V and want to use Intel HAXM for speeding up Android emulator. You can disable Microsoft Hyper V by this command with administrator role
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Wait for a moment until this command finishes. Restart computer and then you can install Intel HAXM