Can an AAR include transitive dependencies?
It took a little while but I found what I was looking for. It just happened to be the way I was wording my searches.
This lesser-seen answer was exactly what I was looking for:
Transitive dependencies not resolved for aar library using gradle
Note that dependencies are only associated with aar libraries if they are hosted in a maven repository, in the first place, as the pom file is not included in the aar.
Essentially, I needed to add a
transitive = true
...to the build.gradle
of Bar
Example:
compile ('com.foo:FOO:1.0.0@aar'){
transitive=true
}
This way it includes all of my transitive libraries.
Note, however, that this may actually cause conflicts between dependencies (especially local ones) which can be resolved using an exclude
tag.
Transitive dependencies for local aar library
The aar file doesn't contain the nested (or transitive) dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir
repo you have to specify the dependencies also in your project.
In your case adding transitive=true
doesn't resolve your issue for the reason described above.
You should use a maven repository (you have to publish the library in a private or public maven repo), you will not have the same issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.
Transitive dependencies not resolved for aar library using gradle
I have solved my problem by setting transitive
attribute for my aar dependency:
compile ('com.somepackage:LIBRARY_NAME:1.0.0@aar'){
transitive=true
}
How to set transitive = true for local .aar library?
It is not possible to download transitive dependencies with a local aar file.
This file does not contains a pom.xml
which reference all dependencies linked to this library, so adding transitive = true
will do simply nothing.
If Cuckoo library is not hosted in a Maven repository, I'm afraid you will be obliged to load them manually in your build.gradle
.
Android aar library doesn't contain dependencies
what should i do to make my main project see my library's third party dependencies?
The aar file doesn't contain the transitive dependencies and doesn't have a pom file which describes the dependencies used by the module.
It means that, if you are importing a aar file using a flatDir
repository you have to specify the dependencies also in your project.
You should use a maven repository, private or public, to avoid the issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.
Related Topics
Download Multiple Files with a Progress Bar in Listview Android
Android Java - Joda Date Is Slow
Can You Launch the Native Camera App from an HTML 5 Web App
How to Read and Edit Android Calendar Events Using the New Android 4.0 Ice Cream Sandwich API
Command Line "Android Update Sdk" on Headless Linux
How to Update Notification with Remoteviews
Best Way to Update Data with a Recyclerview Adapter
Android - Sharedpreferences with Serializable Object
How to Customize List Preference Radio Button
Enabling General JavaScript in Webviewclient
Change the Right Margin of a View Programmatically
How to Change the Track Color of a Switchcompat
How to Capture Image from Custom Cameraview in Android
Difference Between a Clickable Imageview and Imagebutton
Android Failed to Install Helloworld.Apk on Device (Null) Error
Cordova Plugin Development - Adding Aar