3

I have the following structure for my project:

LibD(JNI) ---- LibC --- LibA -----|
                                  |----MyLibrary
                        LibB -----|

MyLibrary depends on LibA and LibB

LibA depends on LibC

LibC depends on LibD which is a native library

I need to generate a single AAR file for MyLibrary that includes all other libraries and .so files from LibD using Gradle so I can put it on a maven repo

Note: These are not 3rd party libraries and I have the source code. I needed to separate them for reusability.

I have already tried the following, but it generates a separate .AAR files for each module

build.gradle - MyLibrary

apply plugin: 'android-library'
dependencies {
    compile project(':LibA')
    compile project(':LibB')
}

build.gradle - LibA

apply plugin: 'android-library'
dependencies {
    compile project(':LibC')
}

build.gradle - LibC

apply plugin: 'android-library'
dependencies {
    compile project(':LibD')
}

Any help/suggestion would be appreciated.

**** I've already looked at Android Studio how to package single AAR from multiple library projects? but since its an old topic I'm posting the question again

Community
  • 1
  • 1
Ardavan Kalhori
  • 1,664
  • 1
  • 18
  • 32
  • 1
    AFAIK, the accepted answer in the mentioned question still holds. There's no mechanism to produce a single aar. You can write it yourself. But it's not a simple task. – Tomik Mar 31 '16 at 08:46
  • At the time, the arguments were that it is not easy to merge Manifests and resources. However, we now have a Manifest merger and a resource merger. So I don't know what is still a blocker for this. – Gaëtan Jun 10 '16 at 13:29
  • Possible duplicate of [Android Studio how to package single AAR from multiple library projects?](https://stackoverflow.com/questions/20700581/android-studio-how-to-package-single-aar-from-multiple-library-projects) – bummi Aug 29 '17 at 11:40

0 Answers0