Repository navigation
Description
Steps to reproduce
AGP 9 supports Built-in Kotlin via android.builtInKotlin=true.
When migrating an existing Flutter app to Built-in Kotlin, the Flutter Gradle
plugin rejects the build during configuration:
Error: Your project's Kotlin version (2.2.10) is lower than Flutter's minimum
supported version of 2.2.20.
The version cannot be upgraded independently because Built-in Kotlin is bundled
with AGP. AGP 9.4.0 (latest stable as of 2026-09-02), as well as
9.5.0-alpha03, bundle Kotlin 2.2.10.
Environment:
- Flutter 3.47.2
- AGP 9.3.2
- Gradle 9.7.1
- `android.builtInKotlin=true`
Expected behavior:
Flutter should support AGP Built-in Kotlin, or document a compatible AGP version.
The KGP version validation should not reject a version that is bundled and
controlled by AGP.
Actual behavior:
The build fails while applying dev.flutter.flutter-gradle-plugin, before
project tasks are configured.
Stack trace:
com.flutter.gradle.DependencyVersionChecker.checkKGPVersion
1. Create or migrate a Flutter app to AGP 9.
2. Set android.builtInKotlin=true in android/gradle.properties.
3. Remove org.jetbrains.kotlin.android / kotlin-android from Android Gradle files.
4. Run an Android Gradle task, for example fvm flutter build apk.
5. Observe the Kotlin minimum-version validation failure.
Environment: Flutter 3.47.2, AGP 9.3.2, Gradle 9.7.1.
Expected results
Flutter should support AGP Built-in Kotlin or skip KGP version validation when android.builtInKotlin=true. If a newer AGP is required, Flutter should report the required compatible AGP version.
Actual results
Error: Your project's Kotlin version (2.2.10) is lower than Flutter's
minimum supported version of 2.2.20.
The failure occurs while applying dev.flutter.flutter-gradle-plugin, in:
com.flutter.gradle.DependencyVersionChecker.checkKGPVersion
Built-in Kotlin is provided by AGP, so its version cannot be upgraded independently. AGP 9.4.0 and 9.5.0-alpha03 still bundle Kotlin 2.2.10.
Code sample
Code sample
android/gradle.properties
android.builtInKotlin=true
android.newDsl=false
android/settings.gradle
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "9.3.2" apply false
}
android/app/build.gradle
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.47.2, on macOS 26.6.2 25G83 darwin-arm64, locale en) [379ms]
• Flutter version 3.47.2 on channel stable at /Users/aleksandrpavlenko/fvm/versions/3.47.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3b14c8769 (6 days ago), 2026-08-26 16:07:51 -0700
• Engine revision a804b26164
• Dart version 3.13.2
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-macos-arm64-only
[!] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [1,025ms]
• Android SDK at /Users/aleksandrpavlenko/Library/Android/sdk
• Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
• Platform android-37.1, build-tools 37.0.0
• Java binary at: /opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Homebrew (build 25.0.4.1)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 26.6) [970ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17F113
• CocoaPods version 1.17.0
[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (2 available) [10.0s]
• macOS (desktop) • macos • darwin-arm64 • macOS 26.6.2 25G83 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 152.0.7977.65
! Error: Browsing on the local area network for iPad (Lichi). Ensure the device is unlocked and attached with a cable or associated with the same local area network as
this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone Виталя. Ensure the device is unlocked and attached with a cable or associated with the same local area network
as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone (Александр). Ensure the device is unlocked and attached with a cable or associated with the same local area
network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone 11 lichi. Ensure the device is unlocked and attached with a cable or associated with the same local area network
as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources [368ms]
• All expected network resources are available.
! Doctor found issues in 1 category.
Activity
mbcorona commentedon Sep 2, 2026
Hi @wratheus, thanks for the focused report. Routing to the Android team.
This was also mentioned as one item inside #192111, which has since narrowed to a different AGP 9 bug, so this is the right standalone issue for the built-in Kotlin version problem.
wratheus commentedon Sep 2, 2026
Hi @mbcorona, thanks for reply!
I’d like to add a small clarification.
As I understand it, there are two different Kotlin versions here, and they are easy to mix up.
AGP 9.0 uses Kotlin Gradle Plugin 2.2.10 for Built-in Kotlin:
https://developer.android.com/build/releases/agp-9-0-0-release-notes#runtime-dependency-on-kotlin-gradle-plugin
Gradle also has its own Embedded Kotlin version:
https://docs.gradle.org/9.5.0/userguide/compatibility.html
These are different things.
Gradle's Embedded Kotlin is used by Gradle/Kotlin DSL, while AGP's KGP is the one used for Built-in Kotlin in Android projects.
So the 2.3.x version from the Gradle compatibility table does not mean AGP Built-in Kotlin(KGP) is also 2.3.x.
So.. I can guess that if the
android.builtInKotlin=truefeature is supported, we should be able to use the KGP version that AGP provides out of the boxFor now, I can see this code. That if check block here probably is not enough when this mentioned feature is enabled
Also, here is the bug gist, non-null check if KGP is exist, but for some reason we going checkKGPVersion condition and fall with inproriate version. Perhaps this is where we need to refine the logic if the version exists and is passed from AGP with the built-in Kotlin feature.
source -> https://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/src/main/kotlin/DependencyVersionChecker.kt
wratheus commentedon Sep 2, 2026
I’m going to submit a focused fix that skips KGP min-version validation when
android.builtInKotlin=true, with a regression test.build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
build(android): move to Gradle 9.7.1 / AGP 9.4.0 / Kotlin 2.3.20
Skip KGP version validation for AGP built-in Kotlin (flutter#192206)
chore(android): raise AGP to 8.13.2 for share_plus/package_info_plus
github-actions commentedon Sep 22, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.