What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?
You are using the @aar
notation.
It means that you want to download only the aar
artifact, and no transitive dependencies.
You can check Dependency management in Gradle in the official documentation. In particular:
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.
On a more general note:
Setting transitive = false
on the crashlytics
library causes gradle to ignore all libraries required by crashlytics
(="transient libraries") and not download and link them.
You would have to either manually add the required libraries to your project or rely on other transient libraries added by other dependencies.
Default for gradle is transitive = true
.
Examples and full explanation here: http://www.devsbedevin.net/android-understanding-gradle-dependencies-and-resolving-conflicts/
My guess is that the Crashlytics artifact to which you're referring manually specifies dependencies as not transitive (transitive=false
) so that you aren't forced to bring those dependencies in by default. That's why you're seeing the opposite behavior. For example some developers may not want to pull in all of Google Play Services or whatever else Crashlytics may use if present.
So, by removing that, Gradle no longer pulls in the dependency, and it fails to build. You can specify that dependency manually if you need to.
That being said - I think the bigger issue at hand is that you shouldn't be referencing the Crashlytics artifact directly - you should be using Fabric, and pulling in Crashlytics as a result: https://dev.twitter.com/fabric/android/integrating
Sets whether this dependency should be resolved including or excluding its transitive dependencies. The artifacts belonging to this dependency might themselve have dependencies on other artifacts. The latter are called transitive dependencies.