76

I'm running the latest release of gradle (1.12). In the project's root directory, I run the following command, which as described in this answer by @CommonsWare should give the dependency tree:

When I run it, this happens:

$ gradle -q dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations

The project in question is an Android gradle project created from scratch using the new project wizard built in with Android Studio. My top-level build.gradle file looks like this:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.10.+'
    }
}

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
    }
}

subprojects {
    repositories {
        flatDir {
            dirs "$rootDir/libs"
        }
    }
}

And my settings.gradle file looks like this:

include ':app', ':facebook', 'pullToRefresh'

From what I understand this is a very basic gradle configuration. Does anyone have an idea why the dependency tree function is returning nothing? Let me know if I need to provide more information.

Community
  • 1
  • 1
JMRboosties
  • 15,500
  • 20
  • 76
  • 116

1 Answers1

175

Your top level build.gradle doesn't have any dependencies itself. You'll have to run (from the project root dir):

./gradlew app:dependencies
David
  • 2,537
  • 1
  • 22
  • 15
  • Thank you! I've been trying to figure out how to get a dependency tree for a while now. The key is (as you said) to be in the right directory with the module specific build.gradle. – Caleb Sep 02 '15 at 14:31
  • Question is quite old, but it didn't helped me. This task fails for every module in my project with exception: 'Could not initialize class com.android.sdklib.repository.AndroidSdkHandler '. Even if invoke task for another module (plain java). It always tries to resolve 'app' dependencies. – Konstantin Berkov Mar 22 '18 at 20:21
  • if i do ./ doesn't work without it works (running command from the project root). What could be the reason? – Muhammad Babar Mar 30 '18 at 06:23
  • probably means you aren't on a linux based system - where the `./` is needed to specify a file in the current directory. – methodsignature Sep 24 '18 at 20:34
  • Anyway to just show the dependencies of my release? There's a lot here including test etc... – Ryan R Nov 28 '18 at 23:41