Reasons why Android Phone Emulators so slow?
Every gamer is looking for super-fast speed during mobile or pc gaming, many of them are playing games on pc with an emulator but mostly the Android Phone Emulator is very slow.
Emulator’s slowing reason is that it is emulating the ARM CPU & GPU, unlike the iOS Simulator, which runs x86 code instead of the ARM code that runs on the actual hardware. This means the iOS Simulator is typically faster than actual hardware, and the Android Emulator is slower than actual hardware. Most Android developers I talk to develop on actual hardware, but you need a fast android emulator to complete all your tasks, either on games or testing an android app.
You may see some articles or tips about using the Intel HAXM, BlueStacks Android Emulator for pc, Genymotion Emulator, Android-x86 or some other high-performance Android emulator. These almost always are using an x86/Atom Android image, which runs faster because it doesn’t need to emulate the CPU, running x86 code on your host CPU (much like the iOS Simulator). Yes, they are faster, but the majority of Android devices (in the USA at least) are ARMv7. So you are technically testing on a niche hardware configuration that is not likely to be what your app runs on in the real world. In some parts of the world, Intel Atom-based Android devices are becoming more common, so those emulators do serve a purpose.
The emulator is one of the most powerful tools in the Android developer’s arsenal. It gives you the ability to test your Android projects across more devices than you could ever realistically hope to get your hands on.
However, the emulator does have one massive flaw, which becomes glaringly obvious the first time you launch it. Better get comfortable, because the emulator takes a long time to load. A seriously long time.
Here are some tips to make your emulator faster for any Android development tool, but my examples are specific to Delphi XE5. Many of these tips can be combined for better performance. Using these tips I’ve seen the emulator go from sluggishly terrible to actually usable on a few different systems.
Tips to increase your emulator speed?
1. Install HAXM and Switch to x86
The Android Phone emulator supports system images that emulate two different CPUs: ARM and Intel x86.
Using an x86 system image can speed up the emulator considerably, so this is the option you’ll typically want to opt for. If your IDE and SDK are up to date, then creating an x86 AVD is generally pretty straightforward. When you’re creating a new AVD, simply select the ‘x86 Images’ tab in the ‘System Image’ window, and then choose from one of the available x86 images.
To download additional x86 system images for different versions of the Android operating system, you just need to click the corresponding ‘Download’ link.
However, if you see an error message when you try to create an x86 AVD, or nothing appears in the ‘x86 Images’ tab, then you may not have the Intel Hardware Accelerated Execution Manager (HAXM) installed.
To install HAXM, launch the SDK Manager and make sure the ‘SDK Tools’ tab is selected. Scroll down and you’ll see an ‘Intel x86 Emulator Accelerator (HAXM Installer)’ option — download it.
Unlike most of the other items you download through the SDK Manager, the HAXM driver doesn’t install automatically. To install it manually.
- Open the Android SDK folder on your computer, and navigate to Android/SDK/extras/intel/Hardware_Accelerated_Execution_Manager.
- Double-click the IntelHAXM.dmg file.
- In the window that appears, double-click IntelHAXM.mpkg to start the installation. Follow the on-screen instructions to install.
- Once HAXM is installed, repeat the process of creating a new AVD – this time, you should be able to create an AVD with an x86 system image, or at least download an x86 image if none are currently available.
2. Run-on Parallels Desktop 9
If you must run the emulator in a virtual machine that is not much recommended, There are some reports that Parallels Desktop 9 for Mac OS X is faster than VMWare Fusion. You can test this for yourself with the latest version of VMWare Fusion. The comparison I heard about was between Parallels 9 and Fusion 5, which is now a version behind. Tweak the AVD Hardware Configuration – One advantage of using the Android Phone Emulator is you can test specific hardware configurations, so this one is less useful. But if you increase the memory (within reason) and make the screen smaller (again within reason) that can give you a minor performance increase too.
3. Try to run an Older Version of Android
Sure, Kit Kat is new and Shiney, but not everyone has it yet. The newer versions of Android are typically more demanding on the hardware, so newer may be slower. Check out the Android Platform Version Dashboard and go back to an older, popular version, or just stick with Gingerbread and know you will support close to 98% of all Android devices.
4. Check your Emulator on a Mac
I’ve heard reports that the OpenGLES libraries are faster on Mac OS X than on Windows, because Windows prefers DirectX, while OS X prefers OpenGL. You can use the remote emulator set up to make that work (assuming you have a Mac handy). Likewise, if you have a computer with a newer and more powerful GPU and CPU, then use that one. Be sure you combine this tip with the previous two (to Use Host GPU).
5. Use Actual Hardware
OK, so this doesn’t speed up the emulator, but it is worth mentioning again. There are a number of other advantages besides speed, and Android hardware is pretty cheap compared to iOS hardware. Get a few different devices, and you are set.
6. Don’t Run the Emulator in a Virtual Machine
An emulator is a virtual machine, and running a virtual machine in a virtual machine just compounds the problem. If you are developing in a virtual machine, all is not lost, you can still debug against a remote emulator run the emulator on the host machine.
7. Use Host GPU
There is an option when creating an Android Emulator Instance (called an AVD or Android Virtual Machine) to use the physical GPU on the host machine instead of emulating it in software. This gives a huge performance boost. To create a new Android Emulator, and make sure to enable Use Host GPU. (Not, this is incompatible with the other performance option of Snapshot, but I’ve found Use Host GPU results in better emulator performance, while Snapshot only speeds up emulator startup.)
8. Tweak the AVD Hardware Configuration
One advantage of using the Android Phone Emulator is you can test specific hardware configurations, so this one is less useful. But if you increase the memory (within reason) and make the screen smaller (again within reason) that can give you a minor performance increase too.
9. Copy the OpenGLES libraries
After launching an emulator with Use Host GPU enabled, sometimes you get an error “Could not load OpenGL ES emulation library”. If you do, then use this tip (if you don’t get the error, then skip this tip).
This has two common causes, the first is fixed with a reboot. If that doesn’t work then you need to copy the necessary DLLs to a different directory so the emulator can find them. Simply copy lib*.* from C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools\lib up one folder to C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools (this is assuming you are using the Android tools installed by RAD Studio. Adjust your paths as necessary). Relaunch the emulator and the error should go away, and your emulator should be much faster. There is another method that involves updating path information, but just copying the necessary files is easier.
Generally speaking, we would suggest everyone use tips 3, 6, 7 and maybe 9 but everyone’s situation and needs are different, so pick and test the tips that give you the best Android Phone Emulator AVD performance possible. Good luck, and happy Android development and debugging app!