Search code examples
androidgradleandroid-gradle-pluginandroid-architecture-components

How to find dependencies of library?


I want to find dependencies of a library. For example, in my project, I implement android support library.

implementation 'com.android.support:appcompat-v7:26.1.0'

When I execute ./gradlew :app:androidDependencies,

  • android.arch.lifecycle:runtime:1.0.0@aar
  • android.arch.lifecycle:common:1.0.0@jar
  • android.arch.core:common:1.0.0@jar

As you see, after 2017 Google IO, google import Lifecycle and other architecture components.

  • How can gradle tool find dependencies of library(in this case, support library)?
  • For developer, is there any command to show dependencies of a library ?

Solution

  • Check point 5 of this answer, and use this command or the new Build tab in Android Studio 3.1:

    ./gradlew -q dependencies app:dependencies
    
    ./gradlew -q dependencies app:dependencies --configuration 'productFlavors'DebugCompileClasspath
    

    where 'productFlavors' needs to be replaced by one of your product flavors like production.

    enter image description here

    enter image description here