What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?

Steve Kuo picture Steve Kuo · Jul 30, 2015 · Viewed 69.5k times · Source

What does Gradle transitive = true do exactly? It is not clear from the Gradle documentation. This is in the context of compile within build.gradle. In my case I'm depending Android's crashlytics.

compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
    transitive = true;
}

Several Gradle docs (here and here) imply that "transitive" defaults to true. Yet removing transitive = true results in transitive dependencies not being brought in (in particular KitGroup).

class file for io.fabric.sdk.android.KitGroup not found

The docs say it defaults to true, yet the actual behavior seems to be the opposite.

I am running Gradle 2.2.1. Perhaps the behavior changed between 2.2 and 2.4?

Edit: Related Transitive dependencies not resolved for aar library using gradle

Answer

Gabriele Mariotti picture Gabriele Mariotti · Jul 31, 2015

You are using the @aar notation.
It means that you want to download only the aar artifact, and no dependencies.
You can check this part of documentation:
Check the 1.4.1.2. Artifact only notation section:

An artifact only notation creates a module dependency which downloads only the artifact file with the specified extension. Existing module descriptors are ignored.

Using the @aar notation if you want to download the dependencies, you should add transitive=true.

I'd expect that omitting @aar it should work without adding the transitive attribute.