Create FAT AAR in Android Studio
What is an AAR file?
AAR files can contain Android resources and a manifest file, which allows you to bundle in shared resources like layouts and drawables in addition to Java classes and methods.
It is useful in the following situations:
- When you’re building multiple apps that use some of the same components, such as activities, services, or UI layouts.
- When you’re building an app that exists in multiple APK variations, such as a free and paid version and you need the same core components in both.
What is a FAT AAR file?
Create a single AAR artifact from multiple Android Libraries or own custom AAR / jar file.
Steps to build FAT AAR libraries from Gradle :
Step 1: Add kezong/fat-aar-android at the project and app build.gradle
Step 2: Do changes in AndroidManifest.xml and app-level build.gradle
Comment LAUNCHER activity from AndroidManifest.xml and do the below changes :
Step 3:
Click on Build > Make Module. Then, in the project folder > build > outputs > aar, we will find the FAT AAR containing all the libraries we’ve specified. To check this, unpack the AAR.
If you have any questions or suggestions, please leave them in the comments.
That’s all folks!