Android中的AAR,JAR,DEX,APK之间的差异 [英] Difference between AAR, JAR, DEX, APK in Android

查看:2507
本文介绍了Android中的AAR,JAR,DEX,APK之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android系统或开发环境中,AAR,JAR,DEX和APK文件之间有什么区别?每个人的目的是什么?

In Android systems or development enviroments, what are the differences between AAR, JAR, DEX, and APK files? What is the purpose of each one?

AFAIK,JAR就像.class文件的集合(就像在Java中一样)。

AFAIK, JAR are just like a collection of .class files (like in Java).

AAR是JAR文件+资源。但它的用法是什么?要用于分发Android的开发库吗?

AAR are JAR files + resources. But what's its usage case? To be used to distribute development libraries for Android?

APK似乎类似于.deb或.rpm等软件包。这是在Android上安装应用程序的唯一方法吗?

APK seems to be similar to packages like .deb or .rpm. Is it the only way to install applications on Android?

DEX文件怎么样?编译应用程序......但是与JAR或AAR文件的区别是什么?

What about DEX files? Compiled applications... but what's the difference with a JAR or AAR file?

Moreveor,在为Android分发.so(即本机代码)文件时,最好的方法是什么要做吗?

Moreveor, when distributing .so (i.e. native code) files for Android, what's the best way to do it?

推荐答案

JAR(Java档案)



JAR是一种包文件格式,用于在其平台上分发Java应用程序。它包含已编译的Java类文件+更多文件,如MANIFEST。基本上它只是一个ZIP存档,但有一些限制。

JAR (Java Archive)

JAR is a package file format designed for distribution of Java application on its platform. It contains compiled Java class files + some more files like MANIFEST. Basically it is just an ZIP archive with some restrictions.

DEX是二进制文件格式,所以它被编译。我们可以说, .dex 文件适用于DVM(Dalvik虚拟机),类似于JVM的 .class 文件。

DEX is binary file format, so it is compiled. We could say, that .dex file is for DVM (Dalvik Virtual Machine) something like .class files for JVM.

DEX文件格式实际上是由Android SDK中的dex编译器从java CLASS文件生成的。此编译器将JVM字节码转换为DVM字节码,并将所有类文件放入一个dex文件。

DEX file format is really generated from java CLASS files by dex compiler from Android SDK. This compiler translates JVM bytecode to DVM bytecode and put all class files to one dex file.

APK是专为在其平台上分发Android应用程序而设计的文件格式。它与JAR格式有一些相似之处。同样简单的只是ZIP存档,但APK文件具有预定义的特定结构。例如,它始终必须包含名为 AndroidManifest.xml 的文件等等。此包也以dex格式聚合编译的类。

APK is file format designed for distributing Android application on its platform. It has some similarities with JAR format. Again it is simple just ZIP archive, but APK files have pre-defined specific structure. For example, it always must contains file named AndroidManifest.xml and many more. Also this package aggregates compiled classes in dex format.

AAR是Android库的二进制分发版项目。它具有与APK类似的结构。

AAR is the binary distribution of an Android Library Project. It has similar structure as APK.

这篇关于Android中的AAR,JAR,DEX,APK之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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