Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 449
michael.kebe Avatar asked Nov 21 '11 10:11

michael.kebe


People also ask

What does a .DEX file do?

What is a Dex file? A Dex file contains code which is ultimately executed by the Android Runtime. Every APK has a single classes. dex file, which references any classes or methods used within an app.

Which will convert .class files to .DEX files?

bat --dex' command that can be used to convert Java byte code (. class) files into a Dalvik executable (. dex) file. The next tool used in the "ant -verbose debug" command is the "dex" tool, which converts Java byte code into a .

What is the .class file used for?

A Java class file is a file (with the . class filename extension) containing Java bytecode that can be executed on the Java Virtual Machine (JVM). A Java class file is usually produced by a Java compiler from Java programming language source files ( .

What is meant by DOT DEX file?

A DEX file is an executable file saved in a format that contains compiled code written for Android, Google's Linux-based mobile phone platform. It is technically referred to as a "Dalvik Executable," and can be interpreted by the Dalvik virtual machine.


2 Answers

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

like image 123
Mustafa Güven Avatar answered Sep 28 '22 18:09

Mustafa Güven


There's a Dex File Format and the Class File Format specification from the respective company.

These 2 files are completely different.

like image 42
Buhake Sindi Avatar answered Sep 28 '22 16:09

Buhake Sindi