Repository navigation
fix(android): migrate to Built-in Kotlin, stop applying KGP (#76) - #77
Merged
Merged
Conversation
…76) android/build.gradle applied the Kotlin Gradle Plugin unconditionally. On AGP 9, Flutter flags the plugin with a warning. With android.builtInKotlin=true, the build fails with "Failed to apply plugin 'kotlin-android'". Future Flutter versions make that failure unconditional. - Drop `apply plugin: "kotlin-android"` and `kotlinOptions`, and add kotlin.compilerOptions (jvmTarget 17). - Raise the Flutter floor from 3.27 to 3.44. That is the first Flutter that applies KGP to plugins itself; below it the Kotlin would not compile. The Dart floor is unchanged, because bumping it changes the formatter language version and would reformat 125 files. - Change kotlin-test to kotlin-test-junit. Without KGP, kotlin.test.Test no longer resolves. - Pin Robolectric to SDK 34. AGP 9 gives library tests targetSdk 36, which 4.12.2 rejects. - Move the example to AGP 9.1, Gradle 9.3.1 and builtInKotlin=true so CI covers the new path. Bump workmanager to ^0.10.9 and drop the unused kapt/serialization plugins. - CI pin (.fvmrc) goes from 3.41.9 to 3.47.5. The plugin's Kotlin class set is identical to 1.8.1 in these setups: - 3.47.5 on AGP 9, built-in Kotlin on and off - 3.47.5 on AGP 8 with root KGP - 3.44.0 on AGP 9 and on AGP 8 Guarded by test/unit/issue_76_builtin_kotlin_test.dart, which runs Flutter's detection regex over android/build.gradle.
…Robolectric pin comment (#76)
This was referenced Sep 23, 2026
Merged
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.
Fixes #76.
android/build.gradleapplied the Kotlin Gradle Plugin unconditionally. On AGP 9 Flutter flags the plugin with a warning, and withandroid.builtInKotlin=truethe build fails outright withFailed to apply plugin 'kotlin-android'.Changes
apply plugin: "kotlin-android"andkotlinOptions, and addedkotlin { compilerOptions { jvmTarget = JVM_17 } }.kotlin-testis nowkotlin-test-junit. Without KGP nothing substitutes the JUnit variant, sokotlin.test.Teststopped resolving.robolectric.properties. AGP 9 gives library unit tests targetSdk 36, which Robolectric 4.12.2 rejects.builtInKotlin=true, so CI builds the new path. Bumpedworkmanagerto ^0.10.9, dropped the unused kapt and serialization plugins, and moved the CI pin in.fvmrcfrom 3.41.9 to 3.47.5.Verification (local)
./gradlew testDebugUnitTest: 138 passed, 0 failed, the same as main's CI.flutter test test/unit/: 1233 passed. Security tests: 75 passed. Analyze: 0 issues.test/unit/issue_76_builtin_kotlin_test.dartruns Flutter's own KGP detection regex overandroid/build.gradle. It is red on main and green on this branch.The iOS jobs couldn't be checked locally. This PR is mainly here so CI verifies them under the new pin.