Repository navigation
Flutter Gradle plugin rejects AGP Built-in Kotlin version #192167
Description
Activity
- Reacted by bahaa@kr, Aleksandr Pavlenko, Ivan981508 and Молодцов Георгий
- addedplatform-androidAndroid applications specificallyAndroid applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-androidOwned by Android platform teamOwned by Android platform team
on 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
@VisibleForTesting internal val warnKGPVersion: Version = Version(2, 3, 20) @VisibleForTesting internal val errorKGPVersion: Version = Version(2, 2, 20) <...> @VisibleForTesting internal fun checkKGPVersion( version: Version, project: Project ) { if (version < errorKGPVersion) { val errorMessage: String = getErrorMessage( KGP_NAME, version.toString(), errorKGPVersion.toString(), getPotentialKGPFix(project.rootDir.path) ) project.extra.set(OUT_OF_SUPPORT_RANGE_PROPERTY, true) throw DependencyValidationException(errorMessage) } else if (version < warnKGPVersion) { <...> } }
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.
@JvmStatic fun checkDependencyVersions(project: Project) { <...> val kgpVersion: Version? = VersionFetcher.getKGPVersion(project) if (kgpVersion != null) { checkKGPVersion(kgpVersion, project) } else { project.logger.debug( "Unable to detect project Kotlin Gradle Plugin version. Skipping Kotlin min-version enforcement. " + "This is expected if the project uses AGP built-in Kotlin (android.builtInKotlin) or does not apply KGP." ) } <...>
Reacted by Ivan981508 and Молодцов ГеоргийI’m going to submit a focused fix that skips KGP min-version validation when
android.builtInKotlin=true, with a regression test.- added 7 commits that reference this issue
on Sep 5, 2026 - addedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work listtriaged-androidTriaged by Android platform teamTriaged by Android platform team
on Sep 8, 2026 - added a commit that references this issue
on Sep 8, 2026 - added a commit that references this issue
on Sep 11, 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.- locked as resolved and limited conversation to collaborators
on Sep 22, 2026
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:
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, beforeproject tasks are configured.
Stack trace:
com.flutter.gradle.DependencyVersionChecker.checkKGPVersionExpected 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