I have an Android library that is composed of 2 modules :
Project Root
+-- moduleA
| +-- src
| \-- build.gradle
|
+-- moduleB
| +-- src
| \-- build.gradle
|
+-- build.gradle
+-- settings.gradle
settings.gradle
include ':moduleB', 'moduleA'
moduleA/build.gradle
apply plugin: 'com.android.library'
...
dependencies {
compile project(':moduleB')
}
moduleB/build.gradle
apply plugin: 'com.android.library'
...
When I try to use the AAR generated by gradle, the moduleB's resources are not included. I tried to push both AARs to maven local but same result.
If I change moduleA's type to application instead of library, the generated APK includes the correct resources.
What should I do so I can get an AAR that contains both modules resources?
That is by design.
You have 2 options:
publish both modules as AAR libraries (using something like this: https://github.com/dcendents/android-maven-gradle-plugin). This way, LibraryA will mark a dependency on LibraryB and import it, including resources using classical methods.
build a fat AAR (using something like this: https://github.com/adwiv/android-fat-aar). This is basically what you were expecting to happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With