Migrate Android build to built-in Kotlin and align with the Flutter 3.44 toolchain - #150
Merged
Merged
Conversation
Supersedes the version alignment part of #134, updated to the versions current Flutter stable (3.44.7) expects: - AGP 7.3.1 -> 8.11.1, Kotlin 1.7.21 -> 2.2.20, Gradle wrapper -> 8.14 for both the plugin and the example app - compileSdk 33 -> 36, Java 8 -> 17, coroutines 1.0.1 -> 1.8.1 - Remove the legacy buildscript block from the example root build.gradle (AGP/KGP are declared in settings.gradle since the project moved to the plugins DSL) - Let the example track Flutter's compileSdk/targetSdk defaults - gradle.properties flags added by the Flutter 3.44 auto-migrator The old toolchain was below Flutter 3.44's minimum supported versions (Gradle 8.7 / AGP 8.6), so the example failed to build on current stable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes the incomplete built-in Kotlin migration reported in #148. Flutter 3.44+ applies the Kotlin Gradle plugin (KGP) to plugin projects itself. The previous AGP-version guard around `apply plugin: 'kotlin-android'` did not help, because Flutter's migration check scans the Gradle script text: the guarded apply still triggered the "plugins that apply KGP" warning under AGP 9. Worse, at runtime the guard skipped applying KGP while the text scan made Flutter treat the plugin as self-applying, so the plugin's Kotlin sources were never compiled and app builds failed with "cannot find symbol: FlutterLineSdkPlugin". Following the official plugin-author migration guide (https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors): - Remove the KGP apply and the AGP version guard from the plugin build; KGP stays on the buildscript classpath, matching the Flutter plugin template - Replace android.kotlinOptions with top-level kotlin.compilerOptions - Require Flutter >=3.44.0 / Dart >=3.12.0 in pubspec - Align plugin and example with Flutter 3.44 templates: AGP 9.0.1, Kotlin 2.3.20, Gradle 9.1.0 - Example: drop the app-level kotlin-android plugin id, remove the manifest package attribute (ignored since AGP 9), fix use_super_parameters lints surfaced by the language version bump, include Flutter tool auto-migrations (gradle.properties flags, SPM package references in the Xcode project) - Document the new Flutter version requirement in README Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 23, 2026
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
android.kotlinOptionsmoves to the top-levelkotlin.compilerOptions, and both projects adopt the Flutter 3.44 template versions (AGP 9.0.1 / Kotlin 2.3.20 / Gradle 9.1.0). This raises the requirement to Flutter >= 3.44.0 / Dart >= 3.12.0.Because of the new Flutter minimum, this should ship as a major release (3.0.0), keeping 2.x available for users on older Flutter — as also suggested in the discussion on #134. Version bump and CHANGELOG will be handled by the usual release flow after merge.
Why the AGP-version guard was not enough
The
if (agpMajor < 9) { apply plugin: 'kotlin-android' }guard on master turned out to be insufficient, in two ways (verified against the flutter_tools source and reproduced locally on 3.44.7):kgpRegexGroovyinFlutterPluginUtils.kt), so the guardedapplystill counts as "plugin applies KGP" and triggers the warning reported in Migrate Plugin to Built-in Kotlin #148 whenever the app runs AGP 9+.This is exactly the build failure class reported in #148. After this migration, Flutter applies KGP to the plugin project itself and
:flutter_line_sdk:compileDebugKotlinruns again.Verification (all local, Flutter 3.44.7 stable / Xcode 27 / macOS)
masterexample vs Flutter 3.44.7plugins that apply KGP: flutter_line_sdk) and fails with the missing-symbol error abovegradlew assembleDebug+flutter build apk(debug & release):flutter_line_sdk:compileDebugKotlinexecuted, zero KGP/deprecation warnings from Flutterflutter analyze --fatal-infos/flutter testpub getfails fast with a clear constraint message suggesting Flutter 3.44.7Notes
gradle.propertiesflags (android.newDsl=false,android.builtInKotlin=false, matching whatflutter creategenerates on 3.44), removal of the manifestpackageattribute (ignored since AGP 9), SPM package references added to the Xcode project by the Flutter tool, anduse_super_parameterslint fixes surfaced by the Dart language version bump.ios/flutter_line_sdk/Package.swiftis missing aFlutterFrameworkdependency under the new SPM plugin guideline — worth a small follow-up PR. Also, Xcode 27 (beta) raises the minimum deployment target to 15.0, so the example iOS app fails its integrity check there; both pre-exist on master and are unrelated to the Android migration.🤖 Generated with Claude Code