Gradle & Code Quality

Read a Gradle Dependency Tree and Find the Selected Version

A Gradle dependency tree shows requested modules, selected versions and the paths that introduced them. Read the tree for a specific configuration; a project-wide list without variant context can answer the wrong question.

By Updated 2 min read

Generate a focused report

BASH · REFERENCE EXAMPLE
./gradlew :app:dependencies --configuration releaseRuntimeClasspath
./gradlew :app:dependencyInsight \
  --dependency example-library \
  --configuration releaseRuntimeClasspath

Replace example-library with the relevant module selector. Use the correct module and flavor-specific configuration if your project does not expose the simple release name.

Read version selection correctly

In the Gradle report format, an arrow from one version to another indicates selection or substitution, not two copies of the same dependency being packaged automatically. Repeated subtrees can be abbreviated in the output.

Do not add every visible requested version together to estimate the application's dependency count. The resolved result and variant selection determine what is actually used.

Ask why, not only what

Question Report to use
What is in the release runtime graph? dependencies for that configuration
Why was this version selected? dependencyInsight
Which parent introduced it? Incoming paths in the insight report
Does debug differ from release? Compare corresponding configurations

Platforms, constraints, conflict resolution and substitutions can all influence the selected result. A version catalog alias alone does not guarantee a particular resolved version.

Preserve a reproducible snapshot

Save the report with the commit, wrapper version and relevant lockfiles. Avoid making a conclusion from a developer machine using uncommitted build changes or different repository credentials.

If a dependency is missing, check whether it belongs to another configuration, feature module or included build before concluding that it is not shipped anywhere.

Connect the graph to the artifact

APKLint's Gradle tools can review declarations, and its APK tools can inspect package contents. Neither replaces the build's resolved graph. Use the graph to identify expected code and the artifact to confirm what reached the release, especially when libraries package native code or bundle other classes internally.

Sources and further reading

  1. Gradle: Viewing and debugging dependencies

Reference review: 22 September 2026. Examples illustrate the workflow; check your installed versions, release artifact and account-specific Console requirements before applying them. This guide is not a claim that APKLint executed your project or verified your private account.

APKLint

Android inspection tools and practical release guides. About APKLint · Report a correction