android_eng
android_eng

Reputation: 1370

How to add transitive dependencies of Android archive in gradle

At our company, we have started modularizing our android projects and each has several dependencies. We use JFrog artifactory to host our aar files. Here is the code:

Library A:

compile "com.google.firebase:firebase-crash:$googlePlayServices"
compile "com.google.firebase:firebase-core:$googlePlayServices"
compile "com.squareup.retrofit2:retrofit:$retrofit"

The following does not work. I have also tried removing "@aar" but still nothing. Main Projects:

compile ('com.sample.librarya:librarya:0.0.1@aar'){
    transitive = true
}

and hence I have to add retrofit dependencies to the main app again.

I have done a lot of research and read a lot of SO questions but none of them help hence this question. I also have all dependencies on LibraryA listed in its pom.xml file.

Upvotes: 0

Views: 423

Answers (1)

MartinTeeVarga
MartinTeeVarga

Reputation: 10898

Add both following dependencies:

compile ('com.sample.librarya:librarya:0.0.1@pom')
compile ('com.sample.librarya:librarya:0.0.1@aar')

The first will download the pom and add all it's transitive dependencies on classpath. The second will download the aar.

Upvotes: 2

Related Questions