build.gradle.kts — project setup
Android Studio creates the project for you (New Project → Empty Activity, the Compose template; name "Pica", package eif.viko.lt.pica, minSdk 24). But one file you must understand — app/build.gradle.kts. Everything the app uses lives here.
The important part is the plugins block at the top:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
}
Notice what is NOT here: there is no separate Kotlin plugin. android{} and dependencies{} hold the project config and libraries; for now we only pull in Compose (the BOM manages versions). Retrofit, Koin, Room and the rest arrive in their own lessons.
Verify. Open the project in Android Studio and run a sync (Sync Project with Gradle Files, the elephant icon). On success, at the bottom:
BUILD SUCCESSFUL in 12s
Gradle sync finished
No red errors in build.gradle.kts means the project is ready.
Gotcha (AGP 9). Loads of older tutorials tell you to add the Kotlin-Android plugin to the plugins block:
alias(libs.plugins.kotlin.android) // or id("org.jetbrains.kotlin.android")With AGP 9 you no longer do this — and adding it breaks the build. As of AGP 9, Kotlin is built into the Android Gradle Plugin, so applying
kotlin-androidseparately gives an error like:Error: The 'org.jetbrains.kotlin.android' plugin is not compatible with the built-in Kotlin support in AGP 9. Remove it.Delete that line and sync again. Remember it: AGP 9 → no
kotlin-android. The Compose plugin needs onlykotlin.compose.