How do I show dependencies tree in Android Studio?
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
GUI
- 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.
CLI
(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.
How do I view all the dependencies of a library?
Let's suppose you want to get dependencies graph of your app module. In your terminal/command line, run the below command:
./gradlew :app:dependencies
Moreover, if you want to store the dependency graph generated by above command, just do:
./gradlew :app:dependencies > dependencies.txt
Please note that the dependencies.txt file will be generated and stored in your current working directory.
Android Flavor Specific Dependency Tree
You can get the dependecy tree for a particular flavor and build type combination by running:
./gradlew app:dependencies --configuration <flavorAndBuildType><classpath>
Classpath can be either RuntimeClasspath or CompileClasspath depending on if you're interested in compiletime or runtime dependencies.
An example of getting the runtime dependency tree for the paid version of an app, hitting the production servers and building it for debug would be:
./gradlew app:dependencies --configuration paidProdDebugRuntimeClasspath
Android - How to export dependency tree to a file?
I would try:
./gradlew :app:dependencies > ~/Desktop/output.txt
Related Topics
Play Audio File from the Assets Directory
Enable/Disable Data Connection in Android Programmatically
How to Set Different Label for Launcher Rather Than Activity Title
Replace Selector Images Programmatically
How to Check Current Running Applications in Android
Android Alarmmanager Not Working on Some Devices When the App Is Closed
Android: Access Child Views from a Listview
How to Display a Pdf Document into a Webview
Capture Screen Shot of Googlemap Android API V2
Best Practice: Asynctask During Orientation Change
How to Set Layout_Weight Attribute Dynamically from Code
What to Use Instead of "Addpreferencesfromresource" in a Preferenceactivity
How to Change the Radio Button Icon in an Android Radio Button Group
How to Build an APK File in Eclipse
Difference Between Android.App.Fragment and Android.Support.V4.App.Fragment
How to Get the First Name and Last Name from Android Contacts