Gradle transitive = true
究竟做了什么?从Gradle documentation 不清楚.这是在 build.gradle
中的 compile
上下文中。就我而言,我依赖于 Android 的 crashlytics。
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
transitive = true;
}
几个 Gradle 文档(here 和 here)暗示“传递”默认为 true。然而移除 transitive = true
会导致传递依赖没有被引入(特别是 KitGroup
)。
class file for io.fabric.sdk.android.KitGroup not found
文档说它默认为 true,但实际行为似乎相反。
我正在运行 Gradle 2.2.1。也许行为在 2.2 和 2.4 之间发生了变化?
编辑:相关Transitive dependencies not resolved for aar library using gradle
最佳答案
您正在使用 @aar
表示法。
这意味着您只想下载 aar
Artifact ,而不是传递依赖项。
你可以在 Gradle 中查看依赖管理 在官方documentation .特别是:
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
。
我希望省略 @aar 它应该可以在不添加传递属性的情况下工作。
关于java - Gradle 中的transitive = true 究竟做了什么(w.r.t. crashlytics)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31731014/