Gradle: Print Dependency Graph On Terminal for Android

While using dependencies in your Android projects sometimes it’s natural for some strange errors to pop which do not make any sense. For instance, suddenly a firebase dependency seems broken when you add a different dependency. Sometimes you can have dependencies that do support incremental builds.

These kinda problems arise because the libraries using certain dependencies might have a different version of the dependency than you do.

But as the dependency graph grows, it becomes harder to visualize which dependency has a different version.

If you are facing issues with your Gradle builds in Android Studio because of your dependencies try to print the dependency tree of your project and take a look at what dependencies each library has and exclude them. You can also check which of these support incremental builds here.

Because dependencies which do not support incremental build slows you down and makes your compilation slow.

To print the dependency graph for all dependencies of the app module.

Go to the terminal and type in the root folder.

gradle :app:dependencies


gradle app:dependencies

This should already do the trick.

Sometimes if you are setup needs gradlewrapper executable to be specified explicitly. Use…

./gradlew app:dependencies

You can also read this into a file or extract it to HTML for easy readability or storing.

First add this plugin to your app gradle file.

apply plugin: 'project-report'

You can generate a HTML report,

$ ./gradlew htmlDependencyReport

If you found this useful clap and share :)




Freelance Android Engineer. Founder at Buy Me A Coffee if you find my blog useful:

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Owesome_validator Flutter

Live Data — My take

Easy Map Maker — Create your own interactive map.

Bottom Navigation View: BookLog Application

Write Your First UI Test in Android Using Espresso

Android — Android Auto的Car App Library開始移動到android Jetpack中

Documentation v2.0

How to Scan the QR Code with Huawei Cordova Scan kit

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sowmya Guru

Sowmya Guru

Freelance Android Engineer. Founder at Buy Me A Coffee if you find my blog useful:

More from Medium

Kotlin⚡️: Extension Functions | Erselan Khan

Handling project dependencies using type-safe project accessor

Android Annotation Processing Review&Introduce

Simplify Default Android Release Notes on Fastlane