Search code examples
androidapkaar

Are Android AAR files only used during the build process?


I'm searching for more information about the elusive AAR files which are used for Android Library Archives. I already see how they are added to Gradle files as dependencies to app (APK) projects, but ...

Are AAR files included whole within the APK (I see no evidence at least at https://openapkfile.com/) or are AAR files deconstructed and merged as part of the build process?

My thinking is that they are processed by Gradle / Android Studio and the code is all merged into a single classes.dex. The reason I ask is I'm creating an app built using without Android Studio or Gradle and am figuring out how to include libraries in this format. My current method is to unzip them and merge the file structures.

I'm interested in any links and information regarding the low-level build process.


Solution

  • The content of aar files merges with the application code before building apk. I believe, the main reason for that is specific resource system of android applications. I found this link very helpful. It is about how Bazel builds android applications.