Using Gradle to find dependency tree
Solution 1:
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>
Solution 2:
You can render the dependency tree with the command gradle dependencies
. For more information check the section Listing dependencies in a project in the online user guide.
Solution 3:
If you find it hard to navigate console output of gradle dependencies
, you can add the Project reports plugin:
apply plugin: 'project-report'
And generate a HTML report using:
$ ./gradlew htmlDependencyReport
Report can normally be found in build/reports/project/dependencies/index.html
It looks like this:
Solution 4:
In Android Studio (at least since v2.3.3) you can run the command directly from the UI:
Click on the Gradle tab and then double click on :yourmodule -> Tasks -> android -> androidDependencies
The tree will be displayed in the Gradle Console tab