Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Difference Between JVM and DVM

JVM is the virtual machine that runs java code on different platforms. It acts as an abstract layer between the program and the platform 
on which the java code is running. The portability of Java code is possible only because of the JVM. The javac compiler converts the 
source code file(.java file) into an intermediate java bytecode format which is machine/platform independent. This intermediate file is 
then provided to the target machine/platform where it gets translated into machine code. 

DVM(Dalvik Virtual Machine)
DVM is  a  virtual  machine  to  execute Android applications.  The  Java  bytecode(.class  file) generated  by  javac  compiler  is  converted 
into Dalvik bytecode to make the application source files executable on the DVM. Since Android devices have a definite processing 
capacity, memory, and battery life, the DVM design principle aims to optimize itself so that it can load fastly and run smoothly even on 
low memory/powered devices.
JVM(Java Virtual Machine) DVM(Dalvik Virtual Machine)

It is Stack Based It is registered based which is designed to 
run on low memory.

Source code files are first of all compiled 
into Java bytecode format like JVM. 
Java source code is compiled into Java 
Further, the DEX compiler(dx 
bytecode format(.class file) that further 
tool) converts the Java bytecode into Dalvik 
translates into machine code.
bytecode(classes.dex) file that will be used 
to create the .apk file.

Supports multiple operating systems like 
Support only the Android operation system.
Linux, Windows, and Mac OS.

It has constant pool for every class There is constant pool for ever application

The executable file for the device is .apk 
The executable file for the device is .jar file.
file.
Why bytecode can not run in Android?

We cannot run Java Bytecode on Android because:

•Android uses Dalvik VM(virtual machine) instead of Java VM.
•To run a Java Bytecode you need JVM( Java Virtual Machine).
•Java  in  computers  and  Android  uses  a  separate  environment  to  run  their  code.  Android  has  been  modified  to  run  on  smaller 
devices.
•In Android, we have to novitiate Java class file into Dalvik executable files using an android tool called dx.
.

What us build type in gradle?

Build Type refers to build and packaging settings like signing configuration for a project. For
example, debug and release build types. The debug will use android debug certificate for packaging
the APK file. Android requires that all APKs be digitally signed with a certificate before they are
installed on a device While, release build type will use user-defined release certificate for signing
and packaging the APK.
explain build process in android
AAPT stands for android assets packaging tool. 

•AAPT takes  all  the  resources  present  in res/  directory  and  AndroidManifest.xml(meta  data  of  android  app)  and  compiles  all  the 
resources. It creates a R.java class which has all the resource ids
•Then all the java files including R.java gets compiled into byte code.
•Android application runs on dalvik vm so the byte code is cross compiled to the Dalvik byte code (.dex file)
•The .dex file and the compiled resources together forms the .apk file.
Thank YOU

You might also like