From 3a13ce626d1193435115469be31a9b294a78519a Mon Sep 17 00:00:00 2001 From: EdwynZN Date: Mon, 3 Aug 2026 15:28:14 -0600 Subject: [PATCH 1/2] check not only AGP+9 but builtInKotlin property to apply kotlin-plugin --- workmanager_android/android/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workmanager_android/android/build.gradle b/workmanager_android/android/build.gradle index d08f1188..29289bfb 100644 --- a/workmanager_android/android/build.gradle +++ b/workmanager_android/android/build.gradle @@ -17,7 +17,9 @@ apply plugin: 'com.android.library' // still set `android.builtInKotlin=false` on AGP 9 must migrate to built-in // Kotlin — with that flag no Kotlin plugin compiles at all. def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int -if (agpMajor < 9) { +def builtInKotlin = agpMajor >= 9 && + project.findProperty('android.builtInKotlin')?.toString() != 'false' +if (!builtInKotlin) { apply plugin: 'kotlin-android' } From 635ea4a33595ed8dc8b6456634f8a9b92c7b8501 Mon Sep 17 00:00:00 2001 From: Sebastian Roth Date: Tue, 4 Aug 2026 06:18:28 +0100 Subject: [PATCH 2/2] docs(android): correct comment for builtInKotlin=false support (#722) --- workmanager_android/android/build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/workmanager_android/android/build.gradle b/workmanager_android/android/build.gradle index 29289bfb..6ec2f03c 100644 --- a/workmanager_android/android/build.gradle +++ b/workmanager_android/android/build.gradle @@ -10,12 +10,12 @@ rootProject.allprojects { apply plugin: 'com.android.library' -// AGP 9+ ships built-in Kotlin support; older versions need the Kotlin Gradle -// Plugin (KGP) applied explicitly. Do NOT apply KGP on AGP 9+: it is a no-op -// there for library modules (and deprecated), so Kotlin sources only compile -// via AGP's built-in Kotlin (see flutter/flutter#183910 and #710). Apps that -// still set `android.builtInKotlin=false` on AGP 9 must migrate to built-in -// Kotlin — with that flag no Kotlin plugin compiles at all. +// AGP 9+ ships built-in Kotlin support and enables it by default; older +// versions need the Kotlin Gradle Plugin (KGP) applied explicitly. Flutter +// apps set `android.builtInKotlin=false` in gradle.properties +// (flutter/flutter#183910) to keep the legacy KGP path working for +// unmigrated plugins, so this module must apply KGP itself unless built-in +// Kotlin is active. See #710 and #722. def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int def builtInKotlin = agpMajor >= 9 && project.findProperty('android.builtInKotlin')?.toString() != 'false'