From 3a3b692a57483f2473bcaab97acf1ae336919904 Mon Sep 17 00:00:00 2001 From: y-sakakibara Date: Wed, 1 Apr 2026 22:34:02 +0900 Subject: [PATCH] fix(android): conditionally apply kotlin-android for AGP 9 built-in Kotlin support --- android/build.gradle | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 302170d..c499fa3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,11 @@ rootProject.allprojects { } apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' + +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int +if (agpMajor < 9) { + apply plugin: 'kotlin-android' +} android { if (project.android.hasProperty('namespace')) { @@ -48,8 +52,10 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - kotlinOptions { - jvmTarget = '1.8' + if (agpMajor < 9) { + kotlinOptions { + jvmTarget = '1.8' + } } }