In my Android Studio project, I have two subprojects / modules: an Android application ( App1 ) and an Android library project ( LibraryProject1 ). App1 depends on LibraryProject1 . So far so good.
However, LibraryProject1 , in turn, needs to import the AAR library to work properly.
So my configuration is as follows:
App1 includes LibraryProject1
LibraryProject1 includes dependency.aar
Now, to enable dependecy.aar , I use the method described here:
How to manually enable an external aar package using the new Android Gradle build system
So basically in my build.gradle for LibraryProject1 I have:
repositories { flatDir { dirs 'libs' } } dependencies { compile (name:'dependency', ext:'aar') //my AAR dependency compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' }
Obviously, I placed the dependency.aar file in the libs directory of LibraryProject1
However, this does not work. It seems that the repository added by LibraryProject1 is completely ignored, and the local "libs" folder is not included as a repository, which leads to compilation failure.
If I add the repository from App1 build.gradle , it will work, but I do not want to do this, it needs build.gradle AAR file, not App1 .
How can i do this?