Reputation: 53
I want to build .AAR with dependencies inside. I was looking for a lot but nothing works. Topics are so old. I realized that resultant .AAR should have classes.jar inside and there are directories with .class files. But I don't know how to automatize this process in gradle.
Upvotes: 3
Views: 1620
Reputation: 58
We manage to do this using this Mobbeel fat AAR Gradle plugin: https://github.com/Mobbeel/fataar-gradle-plugin
buildscript {
repositories {
//...
maven {
url 'https://plugins.gradle.org/m2/'
}
}
}
//...
dependencies {
classpath 'gradle.plugin.com.mobbeel.plugin:mobbeel-fataar:1.2.0'
}
Mark dependencies with api
instead of implementation
apply plugin: 'com.mobbeel.plugin'
dependencies {
api 'org.greenrobot:eventbus:3.0.0'
//...
}
fatAARConfig {
includeAllInnerDependencies false
}
This article was helpful: http://wittchen.io/2018/10/02/creating-fat-aar/
Upvotes: 1
Reputation: 6583
Android tooling doesn't support it. There's an issue open requesting Google to implement it (feel free to star it to show your support and to help Google to prioritize it).
In the meantime, there are two plugins to try to fix or workaround this lack of support, with limited support of different functionalities:
So, as you can see the future doesn't look bright.
See also this article for more information.
Upvotes: 3