My goal is to see the tree of dependencies (such as: appcompat, dagger, etc) in a particular project.
Like the one IntelliJ:
My goal is to see the tree of dependencies (such as: appcompat, dagger, etc) in a particular project.
Like the one IntelliJ:
The image in the question doesn't really show a tree, just a flat list of everything compiled into the app.
Are you using Gradle?
If so, you can truly see the "tree" by running a Gradle command
Android documentation: View the dependency tree
- Select View > Tool Windows > Gradle (or click Gradle icon in the tool windows bar).
- Expand AppName > Tasks > android and double-click
androidDependencies
. After Gradle executes the task, the Run window should open to display the output.
(produces tree-like list)
./gradlew app:dependencies
and/or
(produces flat list)
./gradlew app:androidDependencies
Where app
is your module's name
And you get something like so
+--- MyApp:mylibrary:unspecified
| \--- com.android.support:appcompat-v7:25.3.1
| +--- com.android.support:animated-vector-drawable:25.3.1
| | \--- com.android.support:support-vector-drawable:25.3.1
| | \--- com.android.support:support-v4:25.3.1
| | \--- LOCAL: internal_impl-25.3.1.jar
| +--- com.android.support:support-v4:25.3.1
| | \--- LOCAL: internal_impl-25.3.1.jar
| \--- com.android.support:support-vector-drawable:25.3.1
| \--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
\--- com.android.support:appcompat-v7:25.3.1
+--- com.android.support:animated-vector-drawable:25.3.1
| \--- com.android.support:support-vector-drawable:25.3.1
| \--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
+--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
\--- com.android.support:support-vector-drawable:25.3.1
\--- com.android.support:support-v4:25.3.1
\--- LOCAL: internal_impl-25.3.1.jar
For specific flavor use the command
gradle app:dependencies --configuration <flavorNameRuntimeClasspath>
Note: If you run ls
(or dir
on Windows) in that folder, and don't see gradlew
(or gradlew.bat
), you are in the wrong folder.
./gradlew appName:dependencies
. In Android Studio it can be found under appName > Tasks > help > dependencies
. –
Sunup dependencies
and androidDependencies
are different, though –
Snowman androidDependencies
task like the one in your answer. The results were just a flat list like the end result of a Gradle dependency search. Any idea why and how to get a tree like in your answer? –
Sunup app:dependencies
–
Snowman ./gradlew app:androidDependencies
. –
Kaikaia ./gradlew app:androidDependencies
task, the tree will be flat as oppose to what your answer describes. I understand you copied from the docs, but it won't be the first time they are wrong/outdated. –
Kaikaia ./
. In Mac or Linux it is usually required. –
Adage On the right side, open the gradle tab > click the gradle icon (execute gradle task), in the popup dialog enter :
app:dependencies
in the command line field > ok
app:
and just executed dependencies
. This gives more useful output than the method in norbDEV's answer as it shows a dependency tree. Possibly the same output as ./gradlew dependencies
but without the requirement of installing a JDK. –
Galop app
is the default module for Android Studio projects. If you have no modules, or want to see dependencies for all modules, yes, gradle dependencies
also works –
Snowman Inspect and visualize each dependency in the dependency graph of your project, as resolved by Gradle during project sync, by following these steps:
dependencies
In the Run panel you will find the dependency tree.
Another method:
Open the Gradle panel
Find the "(root)" postfix and open (app's folder name)
Open the Tasks node
Open the android node
Double click on the "androidDependencies"
In the Run panel you will find the dependency list
Before a normal build switch back to the normal Build Configuration (next to the hammer)
How to find what dependency is updated: https://github.com/ben-manes/gradle-versions-plugin
Usage
Add this to project level build.gradle
apply plugin: "com.github.ben-manes.versions"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.github.ben-manes:gradle-versions-plugin:0.20.0"
}
}
Sync Now
dependencyUpdates
In the Run panel you will find the result.
terminal command to see all dependencies list is
./gradlew -q dependencies app:dependencies --configuration implementation
Simple use is to type text to Terminal or PowerShell:
./gradlew app:dependencies
Advanced usage:
./gradlew app:dependencies --configuration implementation
./gradlew app:dependencies --configuration testImplementation
./gradlew app:dependencies --configuration androidTestImplementation
© 2022 - 2024 — McMap. All rights reserved.