From 4071894217590dc79a2fef88625d45d41fe2792d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 21 May 2026 22:57:49 -0400 Subject: [PATCH] =?UTF-8?q?fix(android):=20opt=20out=20of=20AGP=209=20buil?= =?UTF-8?q?t-in=20Kotlin=20=E2=80=94=20KSP=20incompatible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AGP 9 enables built-in Kotlin by default (`android.builtInKotlin=true`), which we initially adopted by dropping the `kotlin-android` plugin alias. But KSP isn't compatible with built-in Kotlin yet — Gradle errors out with: > KSP is not compatible with Android Gradle Plugin's built-in Kotlin. > Please disable by adding android.builtInKotlin=false to gradle.properties > and apply kotlin("android") plugin Restored the explicit kotlin-android plugin (root + :app) and added `android.builtInKotlin=false` to gradle.properties. Revisit when KSP gains built-in-Kotlin support. Co-Authored-By: Claude Opus 4.7 (1M context) --- android/app/build.gradle.kts | 8 ++++---- android/build.gradle.kts | 8 ++++---- android/gradle.properties | 6 ++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index a89a5f50..5d5df87d 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,9 +1,9 @@ plugins { alias(libs.plugins.android.application) - // kotlin-android removed: AGP 9.0+ auto-enables Kotlin via the - // android.builtInKotlin=true default. The serialization + compose-compiler - // plugins still need explicit application because they're language-level - // (Kotlin compiler) plugins beyond what built-in Kotlin provides. + // kotlin-android applied explicitly: AGP 9's built-in Kotlin path is + // not compatible with KSP yet. Opted out via + // android.builtInKotlin=false in gradle.properties. + alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.compose.compiler) alias(libs.plugins.ksp) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index d8425a47..b3c00232 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -1,9 +1,9 @@ plugins { alias(libs.plugins.android.application) apply false - // kotlin-android plugin no longer needed: AGP 9.0+ auto-enables via - // android.builtInKotlin=true (default). Kept the serialization + - // compose-compiler plugins, which are language-level (Kotlin compiler) - // plugins still applied explicitly per module. + // kotlin-android needed despite AGP 9's built-in Kotlin: KSP isn't + // compatible with the builtInKotlin path yet, so we opt out via + // android.builtInKotlin=false in gradle.properties. + alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.ksp) apply false alias(libs.plugins.hilt) apply false diff --git a/android/gradle.properties b/android/gradle.properties index b605a620..8e0266b4 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -4,4 +4,10 @@ org.gradle.caching=true org.gradle.configuration-cache=true android.useAndroidX=true android.nonTransitiveRClass=true + +# KSP isn't compatible with AGP 9's built-in Kotlin support (the +# `android.builtInKotlin=true` default). Opt out so we can apply the +# explicit kotlin-android plugin and KSP together. Revisit when KSP +# adds built-in-Kotlin support. +android.builtInKotlin=false kotlin.code.style=official