Skip to content

chore: stop applying KGP (Kotlin Gradle Plugin) in the app, upgrade wakelock_plus to 1.7.0 - #1170

Open
anhappdev wants to merge 1 commit into
masterfrom
chore/migrate-app-off-kotlin-gradle-plugin
Open

chore: stop applying KGP (Kotlin Gradle Plugin) in the app, upgrade wakelock_plus to 1.7.0#1170
anhappdev wants to merge 1 commit into
masterfrom
chore/migrate-app-off-kotlin-gradle-plugin

Conversation

@anhappdev

@anhappdev anhappdev commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Fixes the KGP warnings Flutter 3.44 prints on every Android build.

1. App warning — the Flutter Gradle Plugin now applies kotlin-android itself, and the 3.44 flutter create template no longer lists it in the app's plugins block. Removed it to match. settings.gradle unchanged, so KGP stays pinned at 2.2.20.

2. Plugin warning — was desktop_webview_auth, firebase_app_check, firebase_storage, wakelock_plus:

Plugin Status
wakelock_plus Fixed here — 1.7.0 migrated to Built-in Kotlin (^1.2.8 already allowed it, lockfile only)
firebase_app_check, firebase_storage False positives — already guarded behind agpMajor < 9 || !builtInKotlin; Flutter's regex detector can't see the guard
desktop_webview_auth 0.0.16 No fix exists; transitive via firebase_ui_authfirebase_ui_oauth. Needs an upstream issue

The full migration (android.builtInKotlin=true, kotlinOptionskotlin.compilerOptions) needs Flutter 3.47+ / AGP 9 — deferred to the next toolchain bump.

Verified locally (Flutter 3.44.4 + fresh Android SDK): :app:help succeeds with the app warning gone and wakelock_plus off the plugin list; :app:kgpVersion still reports 2.2.20 (no silent fallback to the bundled 2.0.0); :app:compileDebugKotlin still in the task graph; flutter analyze clean, 79 tests pass.

Draft because full APK assembly can't run in my aarch64 sandbox (AGP ships x86_64-only aapt2) — waiting on CI.

Flutter 3.44 warns that applying the Kotlin Gradle Plugin in the app
project will break future builds, and asks apps to migrate to Built-in
Kotlin:

  WARNING: Your Android app project: app located at: .../app/build.gradle
  applies the Kotlin Gradle Plugin, which will cause build failures in
  future versions of Flutter.

The Flutter Gradle Plugin now applies kotlin-android itself, so the
`flutter create` template for 3.44 no longer lists it in the app's
plugins block. Removing it here matches the template. KGP stays pinned
at 2.2.20 by settings.gradle -- verified with `gradlew :app:kgpVersion`,
which still reports 2.2.20 (not Flutter's bundled 2.0.0), and
`:app:compileDebugKotlin` is still present in the task graph.

Flutter also warned about four plugins applying KGP:

  desktop_webview_auth, firebase_app_check, firebase_storage, wakelock_plus

wakelock_plus 1.7.0 migrated to Built-in Kotlin, so upgrading drops it
from the list (constraint ^1.2.8 already allowed it; lockfile only).

Of the rest:
- firebase_app_check and firebase_storage already guard `apply plugin:
  'kotlin-android'` behind an AGP 9 / android.builtInKotlin check. The
  warning is a false positive -- Flutter detects KGP with a text regex
  that cannot see the guard.
- desktop_webview_auth 0.0.16 is the latest release and is not migrated.
  It arrives transitively via firebase_ui_auth -> firebase_ui_oauth,
  which still pins ^0.0.16, so this one needs an upstream fix.

The full migration (android.builtInKotlin=true, kotlinOptions ->
kotlin.compilerOptions) needs Flutter 3.47+ and AGP 9, so it is left for
the next toolchain bump.
@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@sonarqubecloud

Copy link
Copy Markdown

@anhappdev
anhappdev marked this pull request as ready for review August 18, 2026 05:09
@anhappdev
anhappdev requested a review from a team as a code owner August 18, 2026 05:09
@freedomtan

Copy link
Copy Markdown
Contributor

this is supposed to resolve some of the new warnings reported by @mohitmundhragithub, #1168
@mohitmundhragithub please check this.

@freedomtan freedomtan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mohitmundhragithub you may want to take a look

@anhappdev anhappdev changed the title chore: stop applying KGP in the app, upgrade wakelock_plus to 1.7.0 chore: stop applying KGP (Kotlin Gradle Plugin) in the app, upgrade wakelock_plus to 1.7.0 Aug 18, 2026
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.

2 participants