.class 和 .dex 文件有什么区别?

发布于 2024-12-17 03:04:10 字数 151 浏览 2 评论 0原文

当然,.dex文件是针对Android的Dalvik VM的,而.class文件是针对JVM的。但我想知道它们是否有类似的布局(常量池、字段、方法、属性……)?字节码不同,但是 Dalvik 特定的操作码是否与 JVM 中的操作码等效?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

2024-12-24 03:04:11

Dalvik可执行文件格式是VM执行的代码。 Dalvik VM无法执行Java字节码,它必须编译为dex,因为它使用备用指令集。

阅读wiki 文章

The Dalvik Executable format is the code, the VM executes. Dalvik VM can not execute Java bytecode, it must be compiled to dex, because it uses an alternate instruction set.

Read the wiki article.

昇り龍 2024-12-24 03:04:10

Java jar 文件有许多类文件,而每个 APK 文件只有一个
classes.dex 文件,如下所示。根据 Google 的说法,APK 格式
出于性能和安全原因,它与类文件格式不同。

在此处输入图像描述

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

陈独秀 2024-12-24 03:04:10

Dex 文件格式来自相应公司的类文件格式规范

这两个文件完全不同。

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

These 2 files are completely different.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文