.class 和 .dex 文件有什么区别?
当然,.dex
文件是针对Android的Dalvik VM的,.class
文件是针对JVM的.但我想知道它们是否有相似的布局(常量池、字段、方法、属性……)?字节码不同,但是否存在与 JVM 中的字节码等效的 Dalvik 特定操作码?
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?
推荐答案
Java jar 文件有很多类文件,而每个 APK 文件只有一个classes.dex 文件,如下所示.根据谷歌,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.
相关文章