Using Gradle to find dependency tree

Is it possible to use Gradle to produce a tree of what depends on what?

I have a project and would like to find out all the dependencies so I may be able to prune it a little with forward declarations etc.

14 s
14

Without modules:

gradle dependencies

For Android:

 gradle app:dependencies

Using gradle wrapper:

./gradlew app:dependencies

Note: Replace app with the project module name.

Additionally, if you want to check if something is compile vs. testCompile vs androidTestCompile dependency as well as what is pulling it in:

./gradlew :app:dependencyInsight --configuration compile --dependency <name>
./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>

Leave a Comment