Gradle & Code Quality

Android Version Catalogs: Share Coordinates Without Hiding Dependencies

A Gradle version catalog centralizes dependency aliases and version declarations. It improves consistency, but it does not by itself force every resolved dependency to use the version written in the catalog.

By Updated 2 min read

Keep the catalog readable

An illustrative gradle/libs.versions.toml structure is:

TOML · REFERENCE EXAMPLE
[versions]
example = "1.2.3"

[libraries]
example-client = { module = "com.example:client", version.ref = "example" }

The coordinate is a placeholder, not a real dependency recommendation. A module can refer to the generated alias through the catalog accessors supported by the project.

The Gradle catalog guide explains aliases, bundles and plugin declarations.

Separate catalog versions from resolved versions

Mechanism Purpose
Version catalog Centralize declarations and aliases
Platform or BoM Align compatible module versions
Constraint Influence dependency selection
Lockfile Record resolved versions for reproducibility

A transitive constraint or platform can affect the selected version. Inspect the actual configuration with dependencies or dependencyInsight before claiming that changing a catalog entry changed every runtime artifact.

Choose aliases that expose intent

Prefer stable, descriptive names tied to the library's role or coordinate. Avoid aliases so generic that reviewers cannot tell whether they refer to a plugin, runtime library or test dependency.

Bundles are convenient, but a large bundle can hide unnecessary dependencies. A small module should not inherit an entire application stack merely because one alias is easy to type.

Migrate without changing everything at once

Move existing coordinates into the catalog while preserving versions and scopes, then verify that the resolved graph remains equivalent. Upgrade versions in a separate review where practical. This separates structural migration errors from dependency compatibility regressions.

Use APKLint with the complete context

The Gradle Dependency Checker can review declarations, but aliases may require the accompanying catalog to interpret. A snippet containing only libs.some.alias does not reveal the coordinate or version. Keep the catalog, module usage and resolved report together when diagnosing missing or unexpected libraries.

Sources and further reading

  1. Gradle: Version catalogs
  2. Android Developers: Add build 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