【发布时间】:2017-12-12 09:53:53
【问题描述】:
我的 android 项目中有很多库外部库,我想知道它们来自哪里。
我使用命令行:gradlew :app:dependencyInsight --configuration compile --dependency this answer中提到
如上图所示,尝试找到 recyclerview 库
gradlew :app:dependencyInsight --configuration 编译 --dependency recyclerview
但什么也没找到:
Task :app:dependencyInsight
No dependencies matching given input were found in configuration ':app:compile'
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
witch 提醒我,我的 build.gradle 文件中没有 app:compile 配置。在 gradle 3.0 之后,compile 已经被 implementation 和 api 所取代。所以我改变了命令行如下:
gradlew :app:dependencyInsight --配置实现 --dependency recyclerview
但出错了:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dependencyInsight'.
Resolving configuration 'implementation' directly is not allowed
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
1 actionable task: 1 executed
我在谷歌上搜索了很多关于这个错误的信息,但找不到答案。 后来我用 build.gradle 文件中的 'compile' 替换了所有的 'implementation',并使用了第一个编译配置命令行,并且成功了。
E:\AndroidApps\SqliteLearn>gradlew :app:dependencyInsight --configuration compile --dependency recyclerview
Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
... ...
Task :app:dependencyInsight
com.android.support:recyclerview-v7:26.1.0
\--- com.android.support:design:26.1.0
\--- compile
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
上面的命令行似乎只适用于编译配置。 有没有一个命令行可以做同样的工作并与实现配置一起工作?
【问题讨论】:
标签: android gradle dependencies