Moving an Android module from hard-coded version strings to gradle/libs.versions.toml should change nothing that ships, and you can prove it: dump releaseRuntimeClasspath before and after and diff the two. We ported a small Compose app on AGP 9.4.0, Kotlin 2.3.21 and Gradle 9.6.0 (JDK 17) on our M1 lab Mac. Both versions built, the 548-line runtime dependency tree and the plugin classpath came out identical, and both debug APKs were 8,533,010 bytes. The whole port is one new TOML file and a search-and-replace in each build.gradle.kts.
Why we did this: Peepal and Shopkeeper started life with versions typed into each module’s build file, and client React Native apps often still do. Every upgrade post we write (AGP, Kotlin, Compose) is easier to follow when the versions live in one file, so this is the first step we take on an older Android project.

The app module’s build file before and after, shortened to fit. The full files are below.
What a version catalog is, in one paragraph
Gradle imports a catalog automatically when it finds libs.versions.toml in the root project’s gradle folder, and exposes it to every build script as libs. The file has four sections: [versions], [libraries], [bundles] and [plugins]. A catalog only names coordinates; it does not change how dependencies resolve. Gradle’s platforms page makes the same distinction: platforms (BOMs) influence resolution, catalogs give type-safe accessors. That is why a correct port leaves the resolved classpath untouched.
The starting point
The root build.gradle.kts declared the plugins with versions:
plugins {
id("com.android.application") version "9.4.0" apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.3.21" apply false
}
And app/build.gradle.kts applied them and listed two libraries:
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.compose")
}
dependencies {
implementation("androidx.compose.foundation:foundation:1.10.0")
implementation("androidx.activity:activity-compose:1.10.1")
}
There is no org.jetbrains.kotlin.android plugin: on AGP 9 the project uses the built-in Kotlin support. When we first ran this sample with the old android.builtInKotlin=false and android.newDsl=false flags still in gradle.properties, AGP 9.4.0 warned that both settings are deprecated and will be removed in AGP 10, and the Kotlin plugin warned that org.jetbrains.kotlin.android is no longer required since AGP 9.0. We removed both flags and the plugin before porting. Our AGP 8 to 9.5 guide covers that step.
Step 1: write the catalog
Create gradle/libs.versions.toml next to the wrapper folder:
[versions]
agp = "9.4.0"
kotlin = "2.3.21"
compose-foundation = "1.10.0"
activity-compose = "1.10.1"
[libraries]
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "compose-foundation" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
[bundles]
compose-ui = ["androidx-compose-foundation", "androidx-activity-compose"]
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Notes from the docs that save time:
- Android’s migration guide uses the
groupandnameform shown here. Gradle also acceptsmodule = "group:name"or a single"group:name:version"string. - Use dashes in alias names. Gradle turns
-and_into dots, soandroidx-activity-composebecomeslibs.androidx.activity.compose. - Some names are reserved:
extensions,classandconventioncannot be aliases, andbundles,versionsandpluginscannot be the first part of a library alias.versions-dependencyis rejected;dependency-versionsis fine. - Keep the Kotlin compiler plugins on the same
kotlinversion ref, so they move together on the next upgrade.
Step 2: switch the plugins
Root build.gradle.kts:
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.compose) apply false
}
app/build.gradle.kts:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
}
Two limits from Gradle’s page: a plugin’s version in the catalog is used as a required version, and catalog plugins cannot be used in settings.gradle.kts. If you are still on a Gradle older than 8.1, Android’s guide says the plugins {} block needs @Suppress("DSL_SCOPE_VIOLATION") before alias works.
Step 3: switch the libraries
dependencies {
implementation(libs.bundles.compose.ui)
}
A bundle is optional. If you prefer one line per library, implementation(libs.androidx.compose.foundation) and implementation(libs.androidx.activity.compose) do the same. We use bundles only for groups that always travel together; a bundle that half the modules need ends up pulling libraries into modules that do not use them.
Android’s guide recommends doing this in a fixed order per dependency: add the entry to the catalog, sync, then replace the string with the accessor. On a large module that keeps each change small enough to review.
Step 4: prove nothing changed
This is the part most migration notes skip. Run the same two reports before and after, from the project root:
./gradlew -q :app:dependencies --configuration releaseRuntimeClasspath > before.txt
./gradlew -q buildEnvironment > before-plugins.txt
# ...port...
./gradlew -q :app:dependencies --configuration releaseRuntimeClasspath > after.txt
./gradlew -q buildEnvironment > after-plugins.txt
diff before.txt after.txt && diff before-plugins.txt after-plugins.txt

Real output from our M1 lab Mac. Both diffs were empty and assembleDebug succeeded in both projects.
If the diff is not empty, a version in the TOML does not match the string it replaced, or a library was dropped from a bundle. Fix the catalog, not the diff.
What a typo looks like
We misspelt one accessor on purpose (libs.androidx.activity.compse). The build failed in 3 seconds, during script compilation, with:
e: app/build.gradle.kts:25:43: Unresolved reference 'compse'.
That is the main win over strings. A mistyped coordinate string is only caught when Gradle tries to resolve it. A mistyped accessor fails at once, with a line and column. The message does not suggest the right name, so look at the TOML; Android Studio’s code completion on libs. lists the valid ones.
Gotchas on real projects
- buildSrc and convention plugins. Gradle’s docs say
buildSrcdoes not inherit the catalog automatically. Import it inbuildSrc/settings.gradle.ktswithfrom(files("../gradle/libs.versions.toml"))inside aversionCatalogs { create("libs") { ... } }block. - BOMs. Declare the BOM as a normal library with a version, then the libraries it governs without a version, and use
implementation(platform(libs.your.bom)). The catalog only names them; the BOM still does the resolving. - React Native apps. Libraries under
node_moduleskeep their own Gradle files and versions. A catalog inandroid/gradle/only covers your app module and any modules you own. - Multiple modules. Every module in the build sees the same
libs, so port module by module and run the classpath diff for eachreleaseRuntimeClasspathyou ship.
What to check on your own app
- Save
releaseRuntimeClasspathandbuildEnvironmentoutput before you start. - Port plugins first, then libraries, one module at a time.
- Diff both reports after each module. Empty diff, then commit.
- Search the build files for any
:inside a string independencies {}: that is a version you missed.



