【问题标题】:How to find transitive dependencies in an Android project如何在 Android 项目中找到传递依赖项
【发布时间】:2018-02-22 16:32:45
【问题描述】:

我有问题。我有不想要的依赖,它没有明确包含在 gradle 文件中。我不知道如何找到哪个依赖项传递地包含这个。

我怎样才能知道这个依赖来自哪里?

我试过了

gradlew analyze

但无法编译我的项目

谢谢

【问题讨论】:

    标签: android gradle dependencies libraries


    【解决方案1】:

    dependencyInsight 任务可以为您执行此操作。示例:

     gradle -q lib:dependencyInsight --dependency groovy --configuration compile
    

    或适用于安卓

    gradlew -q app:dependencyInsight --dependency gson --configuration debugCompileClasspath
    

    将说明为什么名称中包含 groovy 的依赖项包含在 lib 项目的 compile 配置中。详情请见doc section

    【讨论】:

    • 使用 gradle 3.0 我们必须使用这样的构造:gradlew -q app:dependencyInsight --dependency gson --configuration debugCompileClasspath
    • 要查找项目中的配置,请运行./gradlew app:androidDependencies。列出了app 模块的所有配置。尽管是默认的,debugCompileClasspath 并不总是在 app 模块中的配置(app 模块也不总是称为 app)。
    猜你喜欢
    • 1970-01-01
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多