Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AcxgxMaQHMSGWzLRpNSkuP
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.
Summary
Fixes #743.
workmanager_androidstill hasapply plugin: 'kotlin-android'in its build file, behind thebuiltInKotlinguard from #721. Flutter detects KGP by running a regex (kgpRegexGroovy) over the build file text, and the regex ignores the surroundingif. As a result:Could not find method kotlin()in workmanager_android fails on AGP 9 when android.builtInKotlin=false (Flutter's default) #722: itsapplysat behindagpMajor < 9, which still counted as "applies KGP".This PR follows the plugin author guide:
workmanager_android/android/build.gradle: removes the guardedapply plugin: 'kotlin-android', theagpMajor/builtInKotlindetection and theagpMajor < 9kotlinOptionsblock. The existing top-levelkotlin { compilerOptions { jvmTarget = JVM_1_8 } }is now unconditional, so it still matchescompileOptions.workmanager_android/pubspec.yaml: raises the minimum to Flutter 3.47.0 / Dart 3.13.0. When built-in Kotlin is not active (AGP < 9, orandroid.builtInKotlin=false, which is Flutter's default), the Flutter Gradle Plugin applieskotlin-androiditself to plugins whose build file doesn't mention it. That is what keeps the workmanager_android fails on AGP 9 when android.builtInKotlin=false (Flutter's default) #722 configuration building without the guard.android.builtInKotlin. Withandroid.builtInKotlin=trueon AGP 9, Flutter 3.44.x applies KGP to the migrated module and the build fails with "The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0". The current guarded 0.10.9 builds in that same configuration, so a 3.44 floor would regress those apps. 3.47.0 is the first release that skips the auto-apply when built-in Kotlin is on (isBuiltInKotlinEnabled), and there is no 3.45/3.46 stable..fvmrc: 3.44.8 → 3.47.7, so CI builds against a version inside the new floor.example/android: Flutter 3.47's build checks reject the example's toolchain, so it is raised to the minimums 3.47.7 accepts:flutter creategenerates on 3.47.7; the floor is 8.14).AGENTS.md: replaces the "must apply kotlin-android … do NOT simplify" note, which this change makes obsolete, with why the module must not mentionkotlin-androidat all and why the floor is 3.47.The example app otherwise stays on AGP 8 and applies KGP itself. Migrating it to AGP 9 and built-in Kotlin is a separate step.
Breaking Changes
There are no API changes and apps need no changes.
The minimum supported SDK rises from Flutter 3.38 / Dart 3.5 to Flutter 3.47 / Dart 3.13, for
workmanager_androidonly. Apps on Flutter < 3.47 (including all of 3.44.x) keep resolvingworkmanager_android0.10.9 throughworkmanager's^0.10.9constraint, so this can ship as a patch and nobody is left without a working version.Before:
After: no KGP reference. Kotlin is compiled by built-in Kotlin, or by the KGP that Flutter applies.
Testing
Flutter 3.47.7, JDK 21:
example:flutter build apk --debug(no skip flags) succeeds against the local packages, using a melos-equivalentpubspec_overrides.yaml.WorkmanagerPluginis in the APK.cd example/android && ./gradlew :workmanager_android:testDebugUnitTest(now on Gradle 9.3.1): BUILD SUCCESSFUL, 63 tests, 0 failures, 0 errors.flutter createapp (AGP 9.1.0, Gradle 9.3.1, KGP 2.4.0) depending on this branch:workmanager_androidwith bothandroid.builtInKotlin=falseand=true.android.builtInKotlin=false: the build succeeds, the warning is gone, andWorkmanagerPluginis compiled and present in the APK.android.builtInKotlin=true: the same.android.builtInKotlin=true, an app depending on onlyworkmanager_android:android.builtInKotlin=false, both build on 3.44.8.Related: flutter/flutter#189770, ABausG/home_widget#461 (same pattern in home_widget)
🤖 Generated with Claude Code
https://claude.ai/code/session_01AcxgxMaQHMSGWzLRpNSkuP