什么是Android中的.dex文件? [英] What are .dex files in Android?

查看:190
本文介绍了什么是Android中的.dex文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 dex文件

有一些疑问
  • 什么是Android中的dex文件?
  • dex如何在Android上工作?
  • 如何在调试Android应用程序时使用它们?
  • 它们类似于Java类文件吗?

我需要具体信息,请对此提供帮助,欢迎提供任何实际示例!

解决方案

关于.dex文件:

Dalvik Virtual Machine(Android系统下的主力军)最显着的特征之一是它不使用Java字节码.相反,引入了一种称为DEX的本地格式,甚至字节码指令也不与Java字节码指令相同.

Compiled Android application code file.

Android程序被编译为.dex(Dalvik可执行文件)文件,这些文件又被压缩为设备上的单个.apk文件.可以通过自动翻译以Java编程语言编写的已编译应用程序来创建.dex文件.

Dex文件格式:

 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在Dalvik Executable Format( .dex 文件)上有文档.您可以在官方文档中找到更多信息: Dex文件格式

.dex文件类似于Java类文件,但是它们在较旧的Android版本上的Dalkvik虚拟机(DVM)下运行,并在安装时在设备上编译为在较新的Android版本上使用ART的本机代码./p>

您可以使用android-sdk中提供的dexdump工具decompile .dex.

还有一些逆向工程技术可以从.dex文件制作jar filejava class file.

I have some questions regarding dex files

  • What is a dex file in Android?
  • How does dex work for Android?
  • How are they used in debugging an Android app?
  • Are they similar to java class files?

I need specific information please help on this and any real examples are welcome!

解决方案

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.

这篇关于什么是Android中的.dex文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆