суботу, 17 вересня 2011 р.

Why is there no x86 native emulator for Android?

This is more of a complaint than a blog article. Nor it is a positive answer to the question stated in the title.
If you've developed apps for Android you probably faced the issue.  The Android emulators (especially Honeycomb 3.0 and post-Honeycomb 3.0+) run terribly slow.  The app is not testable in the emulator.  You are not able to develop it using emulator besides very basic functions.  What's the reason for this?
Turns out that this is because emulator takes a naive approach to emulating the device.  Naive meaning - it emulates the device using a virtual machine that translates ARM opcodes into x86 opcodes. It uses QEMU as a VM layer, which to make it even worst is single-threaded, so it runs all code on one core at the most.

Now if you have ever developed apps for Apple iOS - you know that your app usually runs 1000 times (the number is not precise of course) faster on the emulator on your x86-64, or PPC or whatever platform than on an actual device.  What's the reason?  Right, this is because the build in XCode is set up in such a way that it builds the same native app either for x86 or for ARM architecture - depending on whether you are building for iOS simulator or for the device.  iOS simulator is just a thin window-environment around the actual running app, which runs as a separate process natively on your CPU and can use as much resources of your machine as the machine can give it. For example there are no RAM constraints for an app running in the iOS Simulator - as opposed to the one running on the actual device - where it gets kicked for using too much RAM.  But the main idea as you can get - is to enable fast compile-test-edit-compile cycle.

For Android the architecture of the platform itself asks for an x86 native emulator.  This is because Android app is actually a bytecode which runs on a Dalvik VM - which is sort of a JVM.  So the app itself will not even need to be recompiled to be run on a Dalvik VM built for x86 architecture.  So my question and complaint to Google is stated in the title: "Why is there no x86 native emulator for Android?".  Why Google makes us suffer and struggle with an emulator slower than any box out there?  Are there any obvious reasons why they can not dump the stupid QEMU?  I understand QEMU was a quick and dirty approach at first stages, but right now as the platform has grown and they so want to beat iOS on the market - they could at least help the developers in a great way by creating a fast emulator.

And I am not alone - in this stackoverflow post a person struggles with the same thing and likes to be able to use an Android x86 port from www.android-x86.org to speed up things somewhat. So come on Google, help your devoted developers to live happier lives.

Немає коментарів:

Дописати коментар