Migrate to built-in Kotlin#49
Open
ubxty wants to merge 1 commit into
Open
Conversation
Removes the legacy kotlin-android plugin apply and the Kotlin Gradle Plugin classpath from android/build.gradle, per the official Flutter migration guide at: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors Also migrates the example app (example/android/app/build.gradle.kts and example/android/gradle.properties). Builds cleanly with flutter build apk --debug in the example app, no Kotlin Gradle Plugin deprecation warnings. Bumps minimum Flutter version to 3.44.0 and Dart SDK to 3.12.0 as required by the new compilerOptions DSL.
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.
Migrates the plugin to use built-in Kotlin per the official Flutter
migration guide:
https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
Background
AGP 9.0 will remove support for plugins that apply the Kotlin Gradle
Plugin. Flutter 3.44+ emits a deprecation warning for any plugin that
still does:
This PR removes the legacy
apply plugin: "kotlin-android"line andthe KGP classpath from
android/build.gradle, and the same from theexample app's
example/android/app/build.gradle.kts.Changes
android/build.gradle: remove KGP classpath +apply plugin: "kotlin-android"+kotlinOptions {}block; addkotlin { compilerOptions { jvmTarget = ... } }blockexample/android/app/build.gradle.kts: same migration in the example appexample/android/gradle.properties: flipandroid.builtInKotlin=trueandandroid.newDsl=true(Flutter migrator had set them to false)pubspec.yaml: bump version 0.8.0 → 0.9.0; minimum Flutter 3.44.0, Dart 3.12.0 (required by the newkotlin.compilerOptionsDSL)CHANGELOG.md: new 0.9.0 entry noting the migrationValidation
flutter build apk --debugin the example app on Flutter 3.44.1:app-debug.apkproducedThe new
kotlin { compilerOptions { ... } }block uses theorg.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17enum value asrequired when applying the kotlin-android plugin is removed.
Note on semver
Bumped to 0.9.0 (minor) because the new minimum Flutter version (3.44)
and Dart SDK (3.12) are breaking for consumers on older toolchains.