How Does Native Android Code Written for Arm Run on X86

How does native android code written for ARM run on x86?

Yes, ARM native code runs on Intel x86 using an emulation feature named Houdini

What this library does is reads ARM instructions on the fly and converts them to equivalent x86 instructions. This is the reason why many apps may work as is on x86 without actually having to build an equivalent library.

Sample Image

Does Android x86 emulate ARM?

First thing first, Android apps (pure Java) are not actually being "compiled for ARM, just like Java apps are compiled into a intermediate Java bytecodes to to executed by any platforms that supports JVM, Android apps written in Java are compiled into Dalvik bytecodes to be run on any platform that supports Dalvik VM. In this regard, how Android apps run x86 or ARM or MIPS is similar to how Java apps run on x86, SPARC, POWER, etc.

Of course if an app contains native code, then the app would need to include support for x86 to be run on an x86 emulator or an actual x86 phone/tablet.

As for the second part of your question, remember that the OS part of Android has been compiled to the x86 platform, so I would assume running x86 Android on a x86 computer is exactly same as running, for example, a Windows in a VM when using OSX.

NDK: how to build a lib, so that app can work on arm(s), x86, etc.?

You need just add to Application.mk this string:

APP_ABI := all

Is a signed Android APK-File running on x86- and ARM-Android devices?

Yup, these devices will run an x86 version of the dalvik vm so your application will run just fine with respects to the application itself, it may not run if it needs stuff like GPS,or other cellphone based classes.



Related Topics



Leave a reply



Submit