Gradle中的transitive = true究竟如何(w.r.t. crashlytics)? [英] What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?
问题描述
Gradle transitive = true
究竟做了什么?从 Gradle文档中不清楚。这是在 build.gradle
内的 compile
的上下文中。在我的情况下,我依赖Android的crashlytics。
compile('com.crashlytics.sdk.android:crashlytics:2.2.2 @aar'){
transitive = true;
$ / code>
几个Gradle文档( here 和 here )意味着可传递默认为true。但删除 transitive = true
会导致传入依赖不被引入(特别是 KitGroup
)。
没有找到io.fabric.sdk.android.KitGroup的类文件
文档说它默认为true,但实际行为似乎相反。
我正在运行Gradle 2.2 0.1。也许行为在2.2和2.4之间变化? 编辑:相关使用gradle的aar库没有解决传递依赖问题
您正在使用 @aar
表示法。
这意味着您只需下载aar工件,并且不需要依赖关系。
您可以检查文档:
检查 1.4.1.2 。 Artifact only notation
部分:
只有工件符号才会创建一个模块依赖项,只下载工件文件指定扩展名。使用
@aar $ c $ c> notation,如果你想下载依赖项,你应该添加
transitive = true
。
我会希望省略@aar它应该在不添加传递属性的情况下工作。
What does Gradle
transitive = true
do exactly? It is not clear from the Gradle documentation. This is in the context ofcompile
withinbuild.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 particularKitGroup
).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
解决方案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 the1.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 addtransitive=true
.I'd expect that omitting @aar it should work without adding the transitive attribute.
这篇关于Gradle中的transitive = true究竟如何(w.r.t. crashlytics)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!