From 21a272b8b15a418fd28e334ef61cca2af67330ab Mon Sep 17 00:00:00 2001 From: Frieder Bluemle Date: Thu, 9 Apr 2026 11:06:12 -0700 Subject: [PATCH] Fix JVM target mismatch on AGP 8+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kotlinOptions block that sets jvmTarget to 17 was only applied inside an `if (agpVersion < 8)` guard, presumably assuming AGP 8+ would automatically propagate the Java compileOptions target to Kotlin. It does not — that only happens when using jvmToolchain(). On AGP 8+ with Kotlin 2.x (which defaults to JVM target 21), this caused a build failure: Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (21). Replace the version-guarded compileOptions/kotlinOptions blocks with a single `kotlin.jvmToolchain(17)` call, which is the approach used by both React Native (ReactAndroid) and expo-modules-core. This sets both Java and Kotlin compilation targets in one place, eliminating the mismatch regardless of AGP version. --- android/build.gradle | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index e6e1277..b6e5e15 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -53,22 +53,7 @@ afterEvaluate { android { compileSdkVersion safeExtGet("compileSdkVersion", 33) - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION - if (agpVersion.tokenize('.')[0].toInteger() < 8) { - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.majorVersion - } - } + kotlin.jvmToolchain(17) namespace "expo.modules.passkeys" defaultConfig {