From 6dae4b452f9855d93f512b7c9e9dd8fe495e52fb Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 21 May 2026 22:55:43 -0400 Subject: [PATCH] fix(android): replace deprecated kotlinOptions with kotlin{compilerOptions} `kotlinOptions { jvmTarget = "17" }` inside the `android { }` block was removed in newer Kotlin tooling; replaced with the modern top-level `kotlin { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } }` form. Required after the Kotlin 2.2 + AGP 9 bump; the old DSL was tolerated through AGP 8.7 + Kotlin 2.0 but not through AGP 9's built-in Kotlin. Co-Authored-By: Claude Opus 4.7 (1M context) --- android/app/build.gradle.kts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index b6e7dc89..a89a5f50 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -62,7 +62,6 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { jvmTarget = "17" } buildFeatures { compose = true @@ -78,6 +77,16 @@ android { } } +// Kotlin 2.x: `kotlinOptions { ... }` inside `android { }` is gone; the +// modern shape is the top-level `kotlin { compilerOptions { ... } }` block, +// which works whether Kotlin comes from AGP 9's built-in path or an +// explicit plugin alias. +kotlin { + compilerOptions { + jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + } +} + detekt { toolVersion = libs.versions.detekt.get() config.setFrom(files("$rootDir/config/detekt.yml"))