You usually see this after adding or upgrading a package (Firebase, camera, maps and others). Flutter prints a box like this:
[!] Your project requires a newer version of the Kotlin Gradle plugin.
Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the
version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of
.../android/settings.gradle.
Above it, the real Gradle error is something like:
Module was compiled with an incompatible version of Kotlin.
The binary version of its metadata is 2.1.0, expected version is 1.9.0.
That second message is the useful one. “Binary version 2.1.0” is the Kotlin the package was built with, and “expected 1.9.0” is the Kotlin your project uses. Your project’s Kotlin has to be raised so it can read the package.
Step 1: find where your project sets Kotlin
Open android/settings.gradle or android/settings.gradle.kts. On projects created with Flutter 3.19 or later (or migrated to the new Gradle setup) you’ll find a plugins block:
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}
If there’s no plugins block, your project is older. The version is then in android/build.gradle:
buildscript {
ext.kotlin_version = '1.9.0'
// ...
}
Step 2: raise the version
Change only the Kotlin version number. In the Groovy settings.gradle the syntax is id "org.jetbrains.kotlin.android" version "2.1.0" apply false.
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
Which version to pick:
- At least the “binary version” in the error. If it says 2.1.0, use 2.1.0 or newer.
- At least 2.1.0 on Flutter 3.35. Flutter’s own version checker warns below Kotlin 2.1.0 and stops the build below 1.8.10. 2.1.0 is also what
flutter createwrites in 3.35. - Not newer than your Gradle and AGP support. Each Kotlin Gradle plugin release lists the Gradle and AGP range it supports in the Kotlin Gradle plugin docs. Jumping to the newest Kotlin on an old Gradle swaps this error for “The current Gradle version is not compatible with the Kotlin Gradle plugin”.
If you hit that last error, upgrade Gradle and AGP first. The Gradle and target API checker reads your Gradle files and gives the versions to move to. Flutter 3.35 projects default to Gradle 8.12 and AGP 8.9.1, which work with Kotlin 2.1.0.
Step 3: clean and rebuild
flutter clean
flutter pub get
flutter run
If the same error comes back with a higher version number, a second package needs an even newer Kotlin. Raise it again to that number.
If you can’t raise Kotlin
Sometimes a release is too close to touch the Gradle setup. Then pin the package that brought in the new Kotlin to its previous version in pubspec.yaml, for example some_plugin: 3.1.4 with no caret, and plan the upgrade for after the release. The Flutter package checker shows which packages in your pubspec are behind or discontinued.
Frequently asked questions
Where is the Kotlin version in a Flutter project?
In the plugins block of android/settings.gradle or settings.gradle.kts, as the version of the plugin with id org.jetbrains.kotlin.android. Projects created before Flutter 3.19 that were never migrated set it as ext.kotlin_version in android/build.gradle instead.
What Kotlin version does Flutter 3.35 need?
Flutter 3.35 stops the build if the Kotlin Gradle plugin is older than 1.8.10 and warns if it is older than 2.1.0. New projects created with Flutter 3.35 use 2.1.0.
What does "The binary version of its metadata is 2.1.0, expected version is 1.9.0" mean?
A library in your build was compiled with Kotlin 2.1.0, but your project compiles with Kotlin 1.9.0, which cannot read it. Set your project’s Kotlin Gradle plugin to 2.1.0 or newer.
Do I need to change the Kotlin version in android/app/build.gradle too?
No. The app module applies the Kotlin plugin without a version (id “kotlin-android” or id(“kotlin-android”)); the version comes from settings.gradle or the top-level build.gradle. Change it in one place only.
Stuck on a build or a store release? I fix and maintain Flutter apps, or tell me about your project. More fixes: all Flutter answers.