My project is including some library project. Library is using some aar files and its dependecny is already defined in the module: gradle file. I am facing problem in includ
Monika Moon put me on the correct path but I don't have enough rep points to comment inline above. sigh
So a default Android app built in 2020 with Android Studio 3.5.3 will have the following project structure via the Project View:
--[yourAppName]
--[app]
--[gradle]
build.gradle
In the top level build.gradle files add the 'flatDir' item :
allprojects {
repositories {
google()
jcenter()
// needed so it picks up my aar files
flatDir {
dirs 'libs'
}
}
}
Then in your 'app' folder shown above. You will have these two key resources:
-- [libs] folder where you should drop your aar files
build.gradle file that is the one you add your aar dependencies to.
The default project build will already contain a 'libs' include for you but just in case your version doesn't have it this is what you need to add:
dependencies {
implementation fileTree(dir: './libs', include: ['*.jar'])
implementation(name: 'fileNameBeforeExtension', ext:'aar')
This is clean and works as expected.
The AAR file I'm using is an in-house custom built for internal hardware and will never be on a public repot.