One of the really useful but underrated tools of the Android platform is the Android Emulator. At first glance, it seems like a woefully underpowered replacement for a real Android device, especially with the latest crop of handsets. Many Android developers have and love devices like the Galaxy S4, HTC One, Moto X, LG G2, or Nexus 5 but the emulator has quietly been advancing to be a must-have tool.
Until a few years ago, the Android Emulator ran with ARM system images to match what was shipped on devices. This approach is an advantage over the iOS Simulator because it closely replicates what will happen on the device. Even today it’s still possible to encounter scenarios where the iOS Simulator behaves or functions differently than an iOS device. The ARM architecture came at a price though: the Android Emulator was slower than the iOS Simulator and slower than an Android device. As a result, many old-school Android developers have relied on just using a device for development.
Enter Intel. They had been eager to increase their mobile marketshare and break the dominance of the ARM chip. As a result, they introduced the x86 system images for Android. This allowed Android developers on Ubuntu and other versions of Linux to use KVM (Kernel-based Virtual Machine) to accelerate the Android Emulator. Intel also released a special virtual machine called HAXM (Hardware Accelerated Execution Manager) specifically designed to speed up the Android Emulator. They previewed HAXM at AnDevCon III in March 2012 and released it soon afterwards. Android developers cheered as their emulator suddenly became fast. Even better, this accelerated emulator still replicated the device well, thanks to Dalvik.
Genymotion is the most recent entrant to the Android emulator scene. They are the only commercial option as opposed to the free closed-source HAXM or the open-source QEMU-based default Android Emulator in the AOSP (Android Open Source Project). Based on the open-source project AndroVM and running inside of Oracle’s freely available VirtualBox virtual machine, they offer accelerated Android emulation with style. They have enhanced the stock emulator windows and added accessory panels to control the emulated device features like battery, GPS, and camera. This improves the overall user experience of the Android Emulator. As a commercial entity, they may be able to raise money and execute more quickly to improve the Android Emulator experience further.
Sadly neither HAXM or Genymotion is installed by default along with either the Eclipse-based Android SDK or the next-generation IntelliJ IDEA-based Android Studio. They are relatively easy to install, however, especially considering the productivity improvements they offer to Android developers.
At savvy apps, we have found the accelerated emulators useful in our Android app development, speeding up our development cycles. Instead of switching from the computer display to the device and back, we can keep focus on our main display with the emulator. Instead of slowly typing on the on-screen keyboard, we can type rapidly with our computer keyboard. Instead of tapping on the screen, we can move and click with our mouse button. It also allows us to more easily test edge cases like when the battery is low that is hard to do on the device. There is still a need to test on the device, especially for performance analysis and pixel-perfect asset audits, but we’ve been happy to shift more of our work to the emulator.