0

enter image description here

There are many libs in my android project External Libararies and I want to know where they come from.

I used the command line: gradlew :app:dependencyInsight --configuration compile --dependency mentioned in this answer

Try to find the recyclerview lib as you can see in the picture above

gradlew :app:dependencyInsight --configuration compile --dependency recyclerview

But find nothing:

Task :app:dependencyInsight
No dependencies matching given input were found in configuration ':app:compile'

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

witch reminded me that there is no app:compile configuration in my build.gradle file. After gradle 3.0 compile has been replaced by implementation and api. So I changed the command line as below:

gradlew :app:dependencyInsight --configuration implementation --dependency recyclerview

but went wrong:

FAILURE: Build failed with an exception.
What went wrong:

Execution failed for task ':app:dependencyInsight'.

Resolving configuration 'implementation' directly is not allowed

Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Get more help at https://help.gradle.org

BUILD FAILED in 2s
1 actionable task: 1 executed

I googled a lot about this bug but cannot find a answer. Later I replaced all the 'implementation' with 'compile' in build.gradle file, and used the first compile-configuration command line, and it worked.

E:\AndroidApps\SqliteLearn>gradlew :app:dependencyInsight --configuration compile --dependency recyclerview

Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
... ...

Task :app:dependencyInsight
com.android.support:recyclerview-v7:26.1.0
\--- com.android.support:design:26.1.0
     \--- compile

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

It appears that the command line above only works with compile configuration. Is there a command line that can do the same job and works with implementation configuration?

Vampire
  • 35,631
  • 4
  • 76
  • 102

1 Answers1

0

Have a look at https://docs.gradle.org/current/userguide/userguide_single.html#sec:java_library_configurations_graph, there you find the various new configurations and which are resolvable and consumable.

I think what you want is runtimeElements or runtimeClasspath, not sure which one will work in that situation.

You can also use the dependencies task instead without giving a configuration, that will resolve and display all configurations with their dependencies.

Vampire
  • 35,631
  • 4
  • 76
  • 102