Migrate off legacy Kotlin Gradle Plugin apply per the built-in-Kotlin migration (#636)#643
Open
aki1770-del wants to merge 1 commit into
Open
Conversation
…lutton#636) Flutter 3.44+ deprecates plugins that apply KGP themselves, and AGP 9 removes support for it (built-in Kotlin). Per the official plugin-author migration guide (https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors), apply kotlin-android only when the consuming app's AGP major version is below 9, and replace the android.kotlinOptions block with the kotlin.compilerOptions DSL (requires KGP >= 2.0, already satisfied by kotlin_version 2.2.20). The conditional keeps the plugin buildable for apps on older stable Flutter/AGP versions.
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.
Addresses #636. Applies the official plugin-author migration (docs.flutter.dev → "Migrate to built-in Kotlin" → plugin authors), using the documented variant for plugins that support Flutter versions earlier than 3.44: KGP is applied conditionally only while AGP < 9, and
android.kotlinOptionsmoves to thekotlin { compilerOptions { jvmTarget = ... } }DSL. The buildscript Kotlin classpath is retained because the conditional branch can still apply KGP on older toolchains (kotlin_version 2.2.20 satisfies the compilerOptions DSL floor).Verification (build-verified locally before submitting):
flutter build apk --debugon the example is green on a current pre-release SDK (post-deprecation Gradle semantics, so the new DSL is exercised at configure time) and on Flutter 3.38.3 (older-consumer back-compat).Note: I couldn't capture the warning-disappears transition the 3.44 reporters see — the SDKs I have locally don't emit the KGP deprecation warning even on unmigrated master. This change follows the official migration doc for plugins supporting pre-3.44 Flutter, and the example builds green on both a current pre-release SDK and 3.38.3. Happy to adjust if CI on a newer stable shows anything different.