Android Archive Library (Aar) VS Standard Jar

Android Archive Library (aar) vs standard jar

AAR files are more similar to Jars than to Dlls for the following reason:

Dlls can be shared across applications where as AARs and jars are
packaged in with your app.

AARs vs Jars:

The main difference between a Jar and a AAR is that AARs include
resources such as layouts, drawables etc. This makes it a lot easier
to create self-contained visual components. For example if you have
multiple apps that use the same login screen, with Jars you could
share classes but not the layout, styles, etc., you still had to
duplicate them. With AARs everything is bundled in one neat package.

In conclusion, AARs are a big step in the right direction.

Note:
Similar attempts were made with apk-libs but they are now obsolete as AARs are much better.

Difference between AAR, JAR, DEX, APK in Android

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 simply just a 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.



Related Topics



Leave a reply



Submit