Android Studio如何查看library间的依赖关系

在控制台输入

./gradlew :app:dependencies

 上面指令会打印所有编译模式下的依赖关系,如下部分编译模式:

debugAndroidTestCompileClasspath - Compile classpath for compilation 'debugAndroidTest' (target  (androidJvm)).
debugCompileClasspath - Compile classpath for compilation 'debug' (target  (androidJvm)).
debugUnitTestCompileClasspath - Compile classpath for compilation 'debugUnitTest' (target  (androidJvm)).
releaseCompileClasspath - Compile classpath for compilation 'release' (target  (androidJvm)).
releaseUnitTestCompileClasspath - Compile classpath for compilation 'releaseUnitTest' (target  (androidJvm)).

我们重点关注 debugCompileClasspath(即 debug下的依赖关系) 与 releaseCompileClasspath(即 release下的依赖关系)。可以通过configuration过滤

./gradlew :app:dependencies --configuration debugCompileClasspath

如果日志太长,可以写在本地文件中,命令如下,这样会在项目目录下面生成一个log.txt文件。注意,没有写入完成提示,在执行完后自行查看该文件

./gradlew :app:dependencies --configuration debugCompileClasspath > log.txt

符号的含义:

  • x.x.x (*) 该依赖已经有了,将不再重复依赖。
  • x.x.x -> x.x.x 该依赖的版本被箭头所指的版本代替。
  • x.x.x -> x.x.x(*) 该依赖的版本被箭头所指的版本代替,并且该依赖已经有了,不再重复依赖。

怎么移出重复的依赖包?

api ('jp.wasabeef:recyclerview-animators:2.2.3'){  
   exclude group :'com.android.support',module:'recyclerview-v7' 
   exclude group :'com.android.support',module:'appcompat-v7'
}

参考以下文章:
android studio查看依赖关系

Android studio 如何查看 library 间的依赖关系

android studio去除重复包

Android Gradle 管理依赖包_gradle如何使一个包依赖指定的包_小明code的博客-CSDN博客

运行命令报错:解决 Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8_刘楼主的博客-CSDN博客

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值