TP00Libraries
Add the libraries before the timer starts and sync Gradle. Open gradle/libs.versions.toml first and read its [versions] block: template versions name things differently, and a version.ref to a name that does not exist fails the sync with "Undefined version reference".
Version catalog
TOML
# gradle/libs.versions.toml
[versions]
# Reuse the lifecycle version the template already declares. Newer templates call it
# lifecycle, older ones lifecycleRuntimeKtx. Add coroutines only if it is not there yet.
coroutines = "1.9.0"
[libraries]
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" }
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }Kotlin
// app/build.gradle.kts, inside dependencies { }
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
testImplementation(libs.kotlinx.coroutines.test)If the sync fails and the clock is running, skip the catalog: these three lines in app/build.gradle.kts need no [versions] entries and always resolve. Move them into the catalog afterwards.
Kotlin
// app/build.gradle.kts, inside dependencies { }: the fallback
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.9.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")The TP07 build used lifecycle 2.9.0, coroutines 1.9.0 and Kotlin 2.1.20, in both forms.
Imports
Turn on auto-import: Settings, Editor, General, Auto Import, then under Kotlin check "Add unambiguous imports on the fly". Alt+Enter covers the rest. TP04 lists the four imports it gets wrong or misses.
Only for TP17, multiple screens
TOML
# gradle/libs.versions.toml
[versions]
# kotlin is already in the template's [versions]; check the name before using it below.
navigationCompose = "2.8.9"
[libraries]
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }Kotlin
// build.gradle.kts (root), inside plugins { }
alias(libs.plugins.kotlin.serialization) apply false
// app/build.gradle.kts
plugins {
alias(libs.plugins.kotlin.serialization)
}
dependencies {
implementation(libs.androidx.navigation.compose)
}