Search code examples
javaandroidjvmdalvik

What is the difference between .class and .dex files?


Of course, .dex files are for the Dalvik VM of Android and .class files are for the JVM. But I wonder if they have similar layouts (Constant Pool, Fields, Methods, Attributes, ...)? The bytecode is different, but are there Dalvik specific opcode equivalents to the ones from the JVM?


Solution

  • Whereas a Java jar file has many class files, each APK file has only a single classes.dex file, as shown below. According to Google, the APK format differs from the class-file format for performance and security reasons.

    enter image description here