Repository navigation
Conversation
… mode detection consistent Groovy's Elvis operator treats `false` the same as `null`, so with AGP 9 and `android.builtInKotlin=false` the previous expression still selected built-in mode, skipped KGP and kotlinOptions, and configured kotlin.compilerOptions. On AGP 8 with the property set to `true` the plugin-application and compiler-configuration branches also disagreed. Check the property for presence instead of truthiness, gate it on AGP 9+ (built-in Kotlin does not exist on AGP 8), and drive plugin application, kotlinOptions and compilerOptions from the single resulting boolean. Truth table (AGP x property -> builtIn / applyKGP): 8 x unset -> false / true 9 x unset -> true / false 8 x true -> false / true 9 x true -> true / false 8 x false -> false / true 9 x false -> false / true Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Supersedes #161 (by @453zhangqiang-star, whose commit is kept as the first commit here with authorship intact) and applies the changes requested by @CaiJingLong in that review. Refiled against
mainas offered in the #161 discussion, since the fix PR on the author's fork (453zhangqiang-star#1) has had no response.image_editor_common/android/build.gradlenow supports AGP 9 built-in Kotlin while keeping the Kotlin Gradle Plugin (KGP) path for older AGP versions, so the plugin's minimum Flutter version is unchanged.Why
AGP 9 enables built-in Kotlin by default and fails the build when a library subproject applies
org.jetbrains.kotlin.android. Flutter warns about plugins that still do this and will stop building them in a future release:How
agpMajorfromcom.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.android.builtInKotlin=falseis honoured (Groovy's?:in fix(android): support AGP 9 built-in Kotlin #161 treatedfalseas absent). Built-in Kotlin only exists on AGP 9+, so the property is ignored on AGP 8.if (!builtInKotlinEnabled) pluginManager.apply('kotlin-android')(thepluginManagerform keeps Flutter's static KGP detection from flagging the plugin),kotlinOptions { jvmTarget }only on the KGP path,kotlin { compilerOptions { jvmTarget } }only on the built-in path.Review points from #161, and how each is addressed
android.builtInKotlin=falsetruemust not pick built-in branchesagpMajor >= 9 &&gatekotlinOptions,compilerOptionsbuiltInKotlinEnabledTruth table (Gradle 9.3.1, Groovy 4.0.29; same logic, AGP major injected)
android.builtInKotlinkotlinOptionscompilerOptionsReal builds (Flutter 3.47.9)
builtInKotlin=trueimage_editor/example(AGP/Gradle bumped locally,kotlin-androidremoved from the app module, app namespace made unique, see note)BUILD SUCCESSFUL,:image_editor_common:compileDebugKotlinran, no KGP warningsbuiltInKotlin=falsedependency_overridesimage_editor_commonno longer listed in Flutter's "plugins that apply KGP" warning (other plugins still are)image_editor/exampleNote on the example app: it is not changed in this PR. When you move it to AGP 9 you will also need to give the app module its own namespace: it currently reuses
com.fluttercandies.image_editor, which is the library's namespace, and AGP 9's manifest merger rejects duplicate namespaces (Namespace 'com.fluttercandies.image_editor' is used in multiple modules and/or libraries). Happy to include that here or in a follow-up, whichever you prefer.🤖 Generated with Claude Code