Once you have transferred an APK file to your Android device its stored in /data/app/<package-name>
The classes.dex file is extracted from it and it’s converted to native library, when the App is run the first time, and stored in /data/dalvik-cache. This Machine Code can be run by the CPU.
Each Android device runs a process called Zygote. When an App needs to run Zygote creates a forked version of itself. Which means its a process in memory. Using this forked process and by loading the native library the App can be loaded pretty quickly.
If you are familiar with the Java Virtual Machine(JVM) then you will know that a JVM works on class files which are comprised of byte code. A class file is a compiled version of the Java code.
When it comes to Android then the Java code is first compiled to a class file which in turn is converted to a file called classes.dex – Dalvik Executable format. This is done by a tool called dx
Like JVM in Android’s case its Dalvik which works on the dex file.
A JVM is stack based processor whereas Dalvik is register based. Both are virtual processors though.
The classes.dex file is then compressed with a bunch of other files, like resource and data files, into a ZIP file called an Application Package or APK
This is the file you will eventually upload to the Google Play Store.