androidaar和jar区别_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 are just like a collection of .class files (like in Java).

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

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

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

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

解决方案

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 (Dalvik Executable)

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 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 Application Package)

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值