Date: 2017apr16
OS: Android
Language: gradle
Keywords: Android Studio
Q. What's the best way to include an .aar that I make into several projects?
A. There is all kind of advice out there.
I don't want to copy the .aar to the folder of each project that uses it -- a chore when it changes.
I don't want to make a submodule in the using project for the included .aar.
Here is my solution:
In the top-level build.gradle:
allprojects {
repositories {
jcenter()
flatDir { // ADD THIS
dirs 'e:/AndroidStudioProjects/SharedApp/shared/build/outputs/aar'
}
}
}
In your app-level build.gradle:
dependencies {
...
compile(name:'shared-release', ext:'aar') // ADD THIS
}