Skip to content

fix(android): complete Built-in Kotlin migration (kotlinOptions → kotlin.compilerOptions) - #1096

Merged
Lyokone merged 1 commit into
masterfrom
fix/android-builtin-kotlin-compileroptions
Jul 22, 2026
Merged

fix(android): complete Built-in Kotlin migration (kotlinOptions → kotlin.compilerOptions)#1096
Lyokone merged 1 commit into
masterfrom
fix/android-builtin-kotlin-compileroptions

Conversation

@Lyokone

@Lyokone Lyokone commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #1095.

v10.0.0 already made the kotlin-android (KGP) apply conditional on AGP < 9 (c41aca5), so the plugin no longer applies KGP under AGP 9's Built-in Kotlin. However the migration was incomplete: the android { kotlinOptions {} } block remained. That block is contributed by the kotlin-android plugin and is not available under AGP 9's Built-in Kotlin, so the plugin would fail to configure on AGP 9.

This PR moves the jvmTarget configuration to the top-level kotlin { compilerOptions {} } DSL, which resolves both with KGP (AGP < 9) and with Built-in Kotlin (AGP 9), per Flutter's plugin-author migration guide.

Changes

  • android/build.gradle: replace android.kotlinOptions { jvmTarget = "11" } with top-level kotlin { compilerOptions { jvmTarget = JvmTarget.JVM_11 } }.
  • Bump to 10.0.1 + CHANGELOG entry.

Notes

  • The kotlin {} extension is available in both configurations: with KGP applied (AGP 8) and with Built-in Kotlin (AGP 9), so this is safe across the AGP range the plugin supports. Uses KGP 2.2.20 already declared in the buildscript.
  • On AGP 8 the plugin still applies KGP (unavoidable — AGP 8 has no Built-in Kotlin), so the informational Flutter warning still appears there; it disappears once the app is on AGP 9 / Built-in Kotlin, which this change unblocks.

@Lyokone
Lyokone force-pushed the fix/android-builtin-kotlin-compileroptions branch from 68404eb to 92cd45c Compare July 22, 2026 14:30
Lyokone added a commit that referenced this pull request Jul 22, 2026
The Android e2e job is the only *blocking* job in the e2e workflow (iOS,
Web, macOS and Windows are all already continue-on-error). It was the sole
reason the whole e2e run went red on #1096: Patrol's native UIAutomator
grantPermissionWhenInUse() intermittently returns "Invalid response: 404 --
selector button to allow permission while using found nothing" when the
Android system permission dialog hasn't finished rendering the instant
Patrol polls for it.

This is timing flake, not a regression: the identical test path passed on
#1094 and failed on #1096 with no change to it. Wrap each `patrol test`
invocation in an inline retry (up to 3 attempts, 5s apart). A genuine
failure still exits non-zero after the retries, so real breakage stays red.
The KGP `apply` was already gated behind AGP < 9 (c41aca5), but the
`android.kotlinOptions {}` block remained. That block is provided by the
kotlin-android plugin and is not available under AGP 9's Built-in Kotlin,
so the migration was incomplete and would fail to configure on AGP 9.

Move the jvmTarget configuration to the top-level
`kotlin { compilerOptions {} }` DSL, which resolves both with KGP (AGP < 9)
and with Built-in Kotlin (AGP 9), completing the migration.

Fixes #1095
@Lyokone
Lyokone force-pushed the fix/android-builtin-kotlin-compileroptions branch from 92cd45c to dcbe9cb Compare July 22, 2026 14:52
@Lyokone
Lyokone merged commit 6d57f5f into master Jul 22, 2026
6 checks passed
@Lyokone
Lyokone deleted the fix/android-builtin-kotlin-compileroptions branch July 22, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need support for Built-in Kotlin

1 participant