Gradle 中的传递 = true 究竟做了什么(w.r.t. crashlytics)? [英] What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?

查看:35
本文介绍了Gradle 中的传递 = true 究竟做了什么(w.r.t. crashlytics)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gradle transitive = true 到底做了什么?Gradle 文档 并不清楚.这是在 build.gradle 中的 compile 上下文中.就我而言,我依赖 Android 的 crashlytics.

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;
}

几个 Gradle 文档(这里here) 暗示传递"默认为真.然而,删除 transitive = true 会导致没有引入传递依赖(特别是 KitGroup).

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

文档说它默认为 true,但实际行为似乎相反.

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

我正在运行 Gradle 2.2.1.也许行为在 2.2 和 2.4 之间发生了变化?

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

编辑:相关使用 gradle 的 aar 库未解析传递依赖

推荐答案

您正在使用 @aar 表示法.
这意味着您只想下载 aar 工件,而不要下载传递依赖项.

You are using the @aar notation.
It means that you want to download only the aar artifact, and no transitive dependencies.

你可以在 Gradle 中查看依赖管理在官方文档中.特别是:

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.

如果您想下载依赖项,使用 @aar 表示法,您应该添加 transitive=true.

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

我希望省略@aar 它应该可以在不添加传递属性的情况下工作.

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

这篇关于Gradle 中的传递 = true 究竟做了什么(w.r.t. crashlytics)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆