Transitive dependencyA variant of a component can have dependencies on other modules to work properly, so-called transitive dependencies. Releases of a module hosted on a repository can provide metadata to declare those transitive dependencies. By default, Gradle resolves transitive dependencies automatically.
Gradle automatically resolves those additional modules, so called transitive dependencies. If needed, you can customize the behavior the handling of transitive dependencies to your project's requirements. Projects with tens or hundreds of declared dependencies can easily suffer from dependency hell.
Since gradle 3.4, compileClasspath was added which the Java Plugin uses. Although compileClasspath depends on compile, settings transitive = false on compile is not inherited (by design) and therefore code is compiled with a classpath that includes all the transitive dependencies.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With