How to Display Dependency Tree of Your Android Project with Gradle?

For Starters, simply run the command “gradlew :app:dependencies” in your terminal

Wajahat Karim
AndroidPub
Published in
5 min readMar 10, 2020

--

Gradle Dependency Tree Printed in Console

Recently, in one of my projects, we were stuck at a very annoying exception IllegalStateException: WorkManager is already initialized . We were pretty confident on we have only initialized WorkManager only one time, then why Android Studio is throwing this exception.

The initial hunch we had was there’s some other dependency in our project, which is using WorkManager and that’s why this conflict is popped up. We looked at the build.gradle file and realized that we haven’t added any such dependency in our project which might use WorkManager in any way.

Looking into different solutions like updating / removing dependencies, and plugins, and debugging the app line by line to see where and how it crashes, we simply couldn’t crack the problem. And that’s where it hit me suddenly.

Is it possible to view the whole dependency tree of our project?

Answer is yes. It is possible in Android Studio and even terminal too. This article is about different methods to see how you can view the whole dependency tree of your app.

How Gradle…

--

--

Wajahat Karim
AndroidPub

🔥 Google Dev Expert (GDE) in Android . 📱 Android Dev . 💻FOSS Contributor . 📝 Tech Writer . 🎤 Public Speaker — 🌐Subscribe at https://wajahatkarim.com