正确查看依赖关系./gradlew :app:dependencies

你的命令包含 productFlavors + buildType + custom tasks
所以直接执行

./gradlew :app:dependencies --configuration releaseCompileClasspath

会报错是正常的,因为 releaseCompileClasspath 不一定存在,并且你构建的 Variant 名称跟 release 不同。


一、先找真实 Variant 名称

你现在打包命令是:

./gradlew assembleGmsGoogleXray64Release

所以 Variant 名称通常为:

gmsGoogleXray64Release

依赖项的 configuration 一般是:

<variantName>CompileClasspath

因此:

./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseCompileClasspath

二、列出所有 configuration,找正确名字

./gradlew :app:dependencies

会打印所有 configuration 名称,包括:

gmsGoogleXray64ReleaseCompileClasspath
gmsGoogleXray64ReleaseRuntimeClasspath
...

找到对应行后再单独查看。


三、短命令:让 gradle 帮你打印 Variant

./gradlew :app:dependencies --scan

四、如果你不知道 module 名称

假如 module 为 libssr,则:

./gradlew :libssr:dependencies --configuration gmsGoogleXray64ReleaseCompileClasspath

五、典型配置命名规则

字段示例
productFlavorsgms + google + xray64
buildTyperelease
variantgmsGoogleXray64Release

最终 configuration:

gmsGoogleXray64ReleaseCompileClasspath

六、如果 kapt 依赖想查看

./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseAnnotationProcessorClasspath

或 Kotlin kapt:

./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseKaptClasspath

✅ 常见命令合集

功能命令
查看 compile classpath./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseCompileClasspath
查看 runtime classpath./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseRuntimeClasspath
查看 kapt./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseKaptClasspath
查看 annotationProcessor./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseAnnotationProcessorClasspath

✅ 如果仍不确定

直接打印所有配置:

./gradlew :app:dependencies > deps.txt

打开 deps.txt 搜索:

gmsGoogleXray64Release

马上能找到正确 configuration name。


✅ 最终建议

你的情况最可能命令是:

./gradlew :app:dependencies --configuration gmsGoogleXray64ReleaseCompileClasspath

如果你把 app/build.gradle flavors 名称发我,我也可以帮你直接拼出最终 configuration 名称。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值