Android devices have different processors like ARM and Intel processors. Can Android apps run just the same regardless of which architecture the device has? Or are there apps that will only run on ARM-architecture, etc?
1 Answer
Yes, applications (APKs) are independent of the architecture.
Android is made up of 4 major levels.
The apps you write is compiled into Dalvik EXecutable (DEX) code, which is finally converted into assembly code (according to the required architecture) by the kernel to send to the processor.
So, the kernel is the final one that's responsible to act according to the required architecture and it's compiled by the ROM developer accordingly.
The DEX code is always independent of the architecture, so that application developers needn't worry about the type of processor.
-
Gokul, hi, is that where JIT compiler comes into play? At least for android 4.x and dalvik runtime ? Commented Dec 26, 2015 at 19:54
-
1@moonbutt74 JIT is used during compilation (dynamic codes may or may not compile) and finally converted into corresponding DEX code which is processed accordingly by executing. More info here: m.pocketnow.com/2012/09/11/what-is-jit– Gokul NCCommented Dec 27, 2015 at 3:47
-
So there is actually some sort of local, device-specific compilation going on as the app is being installed on any given device?– FiksdalCommented Dec 27, 2015 at 10:56
-
Regarding the question in my last comment, the top answer here answers it very well: android.stackexchange.com/questions/82978/…– FiksdalCommented Apr 4, 2016 at 5:46