What are .dex files in Android?

后端 未结 3 777
时光说笑
时光说笑 2020-11-27 09:39

I have some questions regarding dex files

  • What is a dex file in Android?
  • How does dex work for Android?
  • How ar
3条回答
  •  一生所求
    2020-11-27 10:16

    About the .dex File :

    One of the most remarkable features of the Dalvik Virtual Machine (the workhorse under the Android system) is that it does not use Java bytecode. Instead, a homegrown format called DEX was introduced and not even the bytecode instructions are the same as Java bytecode instructions.

    Compiled Android application code file.
    

    Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.

    Dex file format:

     1. File Header
     2. String Table
     3. Class List
     4. Field Table
     5. Method Table
     6. Class Definition Table
     7. Field List
     8. Method List
     9. Code Header
    10. Local Variable List
    

    Android has documentation on the Dalvik Executable Format (.dex files). You can find out more over at the official docs: Dex File Format

    .dex files are similar to java class files, but they were run under the Dalkvik Virtual Machine (DVM) on older Android versions, and compiled at install time on the device to native code with ART on newer Android versions.

    You can decompile .dex using the dexdump tool which is provided in android-sdk.

    There are also some Reverse Engineering Techniques to make a jar file or java class file from a .dex file.

提交回复
热议问题