Reputation: 166
I have an Android project that has several modules. It also has a library that consists of several modules as a git submodule. The library is its own standalone project with an app module for testing.
- Project
- app
- module1
- module2
- library (git submodule)
- app (sample app module for testing library)
- module1
- module2 (depends on aar)
updating to Gradle 6.2.1, I got build errors:
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :module2 project caused this error: .../master/module2/libs/my_dependency.aar
Now, if I fix this in the library project by importing the aar as a module, the sample app works fine. However, if I use that same library branch in my master project, I get errors about the aar module not having an AndroidManifest.xml, or the compileSdkVersion is not defined. If I fix those two errors, then there are still class not found errors.
Is this type of aar module supported in a git submodule? Also, the aar dependency works fine using gradle 5.4.1.
Upvotes: 5
Views: 1827
Reputation: 166
https://developer.android.com/studio/projects/android-library#AddDependency The answer is to use Android Studio's new module feature. Choose File->New Module->Import .JAR/.AAR Package-> Select your aar.
Now in your parent directory settings.gradle, be sure to reference the new modules.
Upvotes: 1