what's the meaning of @aar with transitive = true
If you use the ...@artifacttype
notation in a Gradle dependency it means "only get me this artifact and no transitive dependencies". By additionally setting transitive = true
, you are fetching the transitive dependencies despite that fact.
The first version gets the aar
with dependencies and as far as I remember the second always gets the jar
if one is present and else nothing but the dependencies. Add configurations.compile.each { println it }
to output the actual files in the configuration and you should see the difference.
In the case of crashlytics
there is no difference:
compile 'com.crashlytics.sdk.android:crashlytics:2.6.8'
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar
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
.
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
}
Identifying the transitive dependency including a specific library - Gradle
You can use gradle dependencyInsight --dependency org.hibernate:hibernate-core
to see details for given dependency.
Gradle doesn't download transitive dependencies from local jar
If you are hosting the jars in a local folder you will need to adhere to the Maven repository directory conventions and store the pom alongside the jar. Neither gradle nor maven will read a pom.xml zipped inside the META-INF
directory of a jar
Eg:
$projectDir/local-repo/com/foo/bar/1.0/bar-1.0.jar
$projectDir/local-repo/com/foo/bar/1.0/bar-1.0.pom
build.gradle
repositories {
maven {
url = file('local-repo')
}
}
dependencies {
compile 'com.foo:bar:1.0'
}
Related Topics
What Is the Simplest Way to Reverse an Arraylist
Proguard and Reflection in Android
Double Tap: Zoom on Android Mapview
How to Make Edittext Not Focused When Creating Activity
Multidex Noclassdeffound Error
How to Highlight Multiple Words in Edittext
What Does a Java Static Method Look Like in Ruby
What's the Equivalent of Java's Thread.Sleep() in JavaScript
How Is String Concatenation Implemented in Java 9
How to Match Nested Brackets with a Regex Without Using Recursion or Balancing Groups
How to Activate "Share" Button in Android App
How to Update Xml File from Another Xml File Dynamically
Parcelable and Inheritance in Android
Android Maps Utils Clustering Show Infowindow
Android Studio Mailto Intent Doesn't Show Subject and Mail Body