Many of you know how slow the emulator is. Programmers are likely to have finished development and submitted the app to the Play Store before the emulator is done booting up. Fortunately, Google announced that the emulator can now run native on the machine, therefore performing much faster. I spent a bit of time working on this and figured out a useful workflow!
Here’s what to do…
- Go into your Android SDK manager and download the relevant Intel x86 Atom system images.
- Then scroll to the very bottom and in the Extras package you’ll find an item called Intel x86 Emulator Accelerator (HAXM), download that too.
- Now here’s the tricky part, the HAXM installation will say it’s “Installed”, but IT IS NOT. Hover the mouse over it and you’ll see it’s location (On my machine it’s
/Users/Mohannad/android-sdk-macosx/extras/intel/Hardware_Accelerated_Execution_Manager). Go to that folder and you’ll find a .dmg (if it’s mac) or .exe (for windows) file.
- Mount/install that package and that will install the actual accelerator. If you run your emulated device now you’ll find that it is, in fact, much much faster.
- Lastly, since the graphics are still being emulated on the CPU, you will want to check the ‘use Host GPU’ checkbox in the virtual device editor.
Your emulated device is now able to run native on your machine, and really fast. I can even play angry birds at 60 fps on my 2-year old bottom-line Macbook Pro.
PS. If you decide to use the emulator for development you will probably want to enable ‘Hardware keyboard present’, too. Otherwise you won’t be able to type into it from your machine’s keyboard.
Things to keep in mind:
- The Gingerbread (API 10) x86 system image does not support GPU emulation.
- The emulators do not include Google API’s. If you only need Maps, look at this Stackoverflow question.
- If you get a kernel panic when trying to run it, download the official hotfix here.
- Keep in mind that this is an image taken off of an actual Android device, not just a ‘simulator’. This means that if you notice a bug only on the emulator, then you probably just happened to be lucky. There is a actual phone out there that will exhibit that bug. Unfortunately, there have been situations where we ignored a bug on the emulator, and it came back later to haunt us.