You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Gradle获取指定库的依赖树?以com.google.firebase:firebase-firestore:24.4.0为例

获取com.google.firebase:firebase-firestore:24.4.0的Gradle依赖树方法

命令行方式

Groovy/Kotlin DSL 项目(Linux/macOS)

在项目根目录执行以下命令,替换app为你的实际模块名:

./gradlew app:dependencies --configuration implementation | grep -A 20 "com.google.firebase:firebase-firestore:24.4.0"
  • --configuration implementation指定仅查看implementation配置下的依赖,可根据需求替换为compileClasspath、runtimeOnly等
  • -A 20表示显示匹配目标构件后的20行内容,可调整数字控制显示范围

Windows系统(PowerShell)

./gradlew.bat app:dependencies --configuration implementation | Select-String "com.google.firebase:firebase-firestore:24.4.0" -Context 0,20
  • -Context 0,20表示显示匹配行后的20行内容,按需调整参数

Android Studio图形化操作

  • 打开项目后,点击右侧边栏的Gradle面板
  • 依次展开:项目名称 → 目标模块(如app) → Tasks → help
  • 双击执行dependencies任务,等待任务完成后查看底部Run窗口的输出
  • 在Run窗口的搜索框输入com.google.firebase:firebase-firestore:24.4.0,快速定位该构件的依赖树分支

注意事项

  • 确保项目已正确配置Firebase的Maven仓库,否则Gradle无法拉取该构件
  • 若需查看全量依赖树,可去掉命令中的--configuration implementation参数,但输出内容会非常庞大

内容的提问来源于stack exchange,提问作者zeus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 23:01:13