I know that Android uses its own Virtual Machine called Dalvik, and it run .dex file instead of .class file.
Programs are commonly written in Java and compiled to bytecode for the Java virtual machine, which is then translated to Dalvik bytecode and stored in .dex (Dalvik EXecutable)
Why Android needs to first compiled into bytecode for the JVM (.class) and then translates into Dalvik bytecode (.dex), why can't it directly compiled to Dalvik byte code from .java
file ? ?
and If it uses two VM, first JVM and then Dalvik, then doesn't it make the compiling process slow ?
Update:
If i run a program in Java which will compile .java
file into bytecode (.class
) and then interpret it, and If i run the same program in Android, which will first compile .java
file into .class
and that .class
into .dex
and then run it...wouldn't Android be slower in comparison ?