Android: creating an AAR with a library of dependent libraries

We create SDK project with below modules [And its dependencies are listed below]

  • App [Android App]
  • Dev-sdk [android library]
  • Dev-sdk1 [android library]
  • Dev-sdk2 [android library]

App (build.gradle)

dependencies {
    compile project(path: ':Dev-sdk')
}

      

Dev-sdk (build.gradle)

dependencies {
    compile project(path: ':Dev-sdk1 ')
}

      

Dev-sdk1 (build.gradle)

dependencies {
    compile project(path: ':Dev-sdk2')
}

      

Dev-sdk2 (build.gradle)

dependencies {
    // No Dependencies
}

      

When I try to create aar for "dev-sdk" it doesn't include dependencies.

Is there a way to create an AAR for the Dev-sdk module with all its dependencies?

+3


source to share


2 answers


I think you cannot add dependencies the way you want to do in your project. aar

don't have a config file that specifies the dependencies they need. You can do one of the following:



  • Split the code from Dev-sdk1

    to Dev-sdk

    . Since you are the developer of everyone SDKs

    you use, this option is more suitable for you.
  • Or try uploading Dev-sdk1

    to Maven central repository

    or Bintray

    . This way the person who will include Dev-sdk

    in his project can easily add a dependency for Dev-sdk1

    with something like thiscompile abc.fgh.jik:version

+1


source


The aar file contains no transitive dependencies.
Also it doesn't have a pom file that describes the dependencies.



An alternative is to publish the library to a maven repository (public or private). Gradle in this case with pom file can download dependencies too.

0


source







All Articles