Wednesday, October 30, 2013

Speed up your Android development cycle with Genymotion

William J. Francis shares how the free Android emulator called Genymotion greatly increases his productivity.

I've been doing professional Android development for more than four years. At the risk of receiving a plethora of scathing emails and possibly having my Android developer card revoked, I also admit to dabbling in iOS. A big difference I noted right away when I started looking at the Xcode documentation is that during normal iOS development the application runs on a simulator, not a true emulator. While this may sound like merely semantics, it's actually a distinction.

The academic difference between Android's emulator and iPhone's simulator is that, in theory, an Android app running in the emulator should behave nearly identically on a target device; you should also be able to run some level of performance tests on the Android emulator. Doing a performance test on Apple's simulator would be pointless, as these tests would simply be testing the power of your development system.

I qualified these differences as academic because, in my experience, they tend to be a wash. In general, the iOS simulator does a good job of behaving the same way as the target device, and the Android emulator tends to be so slow on most development machines -- any sort of performance testing is almost impossible. The latency of Android's emulator has continued to increase with each iteration of the OS, and starting at about 4.0 (Ice Cream Sandwich), I found myself wishing Google had taken the same road as Apple. The out-of-the-box Android emulator experience has become somewhat painful in the last 18 months. 

Luckily, the open nature of Android has made it easy for third parties to step in, pick up the ball, and run with it. This leads into my discussion of Genymotion, a commercial offshoot of the open source project AndroVM. Genymotion is a very fast, Android emulator that works for Windows, Mac, and Linux.  Best of all (at least for now), it's free. (I don't work for Genymotion or have any affiliation with them.)

Genymotion integrates directly into Eclipse, has a slew of pre-configured popular phone images to choose from, and supports the majority of critical sensor emulation I need to do 99% of my day-to-day development. The only area where I find Genymotion lacking is that I haven't figured out a way to throttle the network connection to emulate 3G, even after reading the documentation. I contacted Genymotion support about this last item, but I have yet to receive a response.

If you aren't familiar with Genymotion, it's definitely worth a look. The installation is slightly more involved on OS X and Linux than on Windows, but it still wasn't overly complicated on my MacBook.  I've included three screenshots so you can see both the emulator and how it plugs into Eclipse. Once configured, you shouldn't have to modify your existing workflow. Start the emulator, and then run and debug the APK from inside of Eclipse just like you did with the Android Virtual Device you were using before.