Android x86 emulator - what a difference

I have a love-hate relationship with Android (and by extension, Mono for Android). I've been a long-time iOS user, and back in the Android 2.x days, the difference was huge - in my mind, there was zero comparison. One was polished, fluid, beautiful. And the other one really, really wasn't.

Having to spend £500 for another phone just to play around with it made it a non-starter.

I tried out Mono for Android about 2 years ago (it's a long time since we had the 3 months in New Zealand!), and while the product itself was good (even for a then-late beta), I didn't have a device, so I was stick in the emulator.

One thing to know here is that on Android (and Windows Phone 7), the on-computer "thing" is an emulator, which means it's running ARM code on your x86 (or x64) machine. This is slow, and always will be slow, there is no way around it. And the Android one was dog slow at the best of times, even on what was at that time a very fast machine.

iOS, by comparison, is a simulator. It's not running ARM code, with stubs for the bits of phone that are not present on the computer (eg GPS). It's running native x86 code, so that whole emulation layer is removed, and the speed difference is astonishing.

On iOS, you need to test on the device because the simulator can be a lot quicker than a real device (not so much now with the 4/4S/5). On Android, you have to test on a real device because the emulator is so slow it's nearly unusable.

However, I've been doing a bit of (Mono for) Android work over the past week or 2, using a real device (Nexus 7 and a Samsung Ace). So far, I'm finding it quite good. The API and its structure is very different to iOS, even tho the resulting apps often look similar. OS version fragmentation freaks me out, however, as I only have these two devices to test on.

So I went back to the emulator. Luckly, a lot has changed in 2 years, and I spotted Willem Meints post on getting the x86 emulator working.

In the post, he details how to setup a new emulator. I had to also download the image from google, which isn't hard, but if you only have Mono for Android installed, with it's self-contained Android SDK, it's not obvious:

{% codeblock %}

cd Library/Developer/Xamarin/android-sdk-mac_x86/tools

./android

{% endcodeblock %}

Then find and install the x86 images you want. I got 2.3 and 4.0.3.

Now, to get it working on the Macbook Pro retina display….