I'm starting to develop with Android Studio and coming from the Java world. If you know in advance that your APK is going to run on Android, why does it need a Virtual Machine like Dalvik or ART? In Java the primary purpose of the virtual machine is to enable the application to run on multiple platforms, but obviously that isn't the case for an APK since by definition it'll always be deployed on Android.
1 Answers
Keep in mind that Android is a significantly less-constrained environment than most Desktop environments. For example, if you're writing a "standard" Windows desktop application you know that your stuff will be deployed to to systems that use an Intel processor (or one that has the same assembly language). You don't know that in Android; most of the time it'll be running on an ARM (RISC architecture) processor but it could just as easily be running on a MIPS (also RISC, but with a somewhat different assembly language) or Atom (CISC architecture, vastly different architecture and assembly language) processor. Point being that in Android you could be deploying to multiple processors with different (possibly vastly different) architectures and assembly languages.
Even for native development, you have to do cross-compilation for several possible processors (see this question for more information on that).

- 1
- 1

- 11,977
- 56
- 49
- 78