Flutter Android build fails: module was compiled with an incompatible Kotlin version
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16Short answer
The compiler met a library built with a newer Kotlin than the one your project uses. Raise the Kotlin Gradle plugin version. In current Flutter projects that version lives in android/settings.gradle, so editing ext.kotlin_version in build.gradle changes nothing on projects that use the plugins block.
Fix it fast
1Find out which cause you have
Find where your project sets the Kotlin version. Both files can hold a value, and only one of them is in use.
cd android grep -n "kotlin" settings.gradle settings.gradle.kts build.gradle build.gradle.kts 2>/dev/null2Match what you see, then jump to its fix
- 1
The expected version in the error is lower than the binary version of the module's metadataThe Kotlin Gradle plugin is older than the libraries it compiles againstFix - 2
You changed the version and the error shows the same expected version as beforeYou edited ext.kotlin_version in build.gradle, but the project reads settings.gradleFix
- 1
What does the error look like?
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16
Cause 1 of 2
The Kotlin Gradle plugin is older than the libraries it compiles against
1Check
Kotlin compilers read libraries from older versions, and read the next version up when no new features are used. A library built with a much newer Kotlin is rejected by an older compiler.
grep -n "org.jetbrains.kotlin.android" settings.gradle settings.gradle.kts 2>/dev/null2Fix
Raise the Kotlin plugin version in the plugins block, to one that fits your Android Gradle Plugin. The Kotlin Gradle plugin releases are listed on kotlinlang.org.
// android/settings.gradle
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
}3Verify
Clean and build again; the metadata error is gone.
flutter clean
flutter build apk --debugConfirmed by docs.flutter.dev
Cause 2 of 2
You edited ext.kotlin_version in build.gradle, but the project reads settings.gradle
1Check
The Flutter docs say that since Flutter 3.16 the Kotlin version is configured in android/settings.gradle. A project created before that point keeps the old ext.kotlin_version line in android/build.gradle. Check which of the two files your project really uses.
grep -n "ext.kotlin_version" build.gradle
grep -n "kotlin" settings.gradle2Fix
Change the value in the file the project actually uses. On an old layout set ext.kotlin_version to a current version; on the new layout edit the plugin line in settings.gradle.
// old layout: android/build.gradle
buildscript {
ext.kotlin_version = '1.9.24'
}3Verify
Build again and read the new expected version in the output, if any error remains.
flutter build apk --debugConfirmed by docs.flutter.dev
How do I stop it coming back?
- After upgrading Flutter, compare your android folder with a freshly created project and keep the plugins block current.
- Update packages and the Kotlin plugin together, not one at a time.
- Keep one place for the Kotlin version and delete the unused one.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Nuclear Home VideoA video-streaming Android app built from scratch, engineered for smooth playback.
Related fixes
Mobile apps
Flutter Android build stops with Execution failed for task ':app:…'
Execution failed for task ':app:compileFlutterBuildRelease'.
The line only tells you which Gradle step broke; the task name in the quotes tells you why.
5 causes, each with a fixMobile apps
Flutter Android build says the project requires a newer Kotlin Gradle plugin
Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions
Flutter's Android build needs Kotlin Gradle plugin 1.5.31 or newer.
2 causes, each with a fixMobile apps
Kotlin cannot find FlutterActivity in MainActivity
Unresolved reference: FlutterEngine
Kotlin only knows FlutterActivity if the import points at the v2 class, io.flutter.embedding.android.FlutterActivity, and the Flutter embedding is on the module's classpath.
3 causes, each with a fixMobile apps
Play Console warns the bundle may be obfuscated and has no mapping file
This App Bundle contains Java/Kotlin code, which might be obfuscated.
This warning is about crash reports, not about your release being blocked.
3 causes, each with a fixMobile apps
Google Play says the app does not support 16 KB memory pages
check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a
Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.
5 causes, each with a fixMobile apps
Android build fails because a product flavor has no flavor dimension
The flavor 'flavor_name' is not assigned to a flavor dimension.
Android Gradle plugin refuses to build when a product flavor is not assigned to a flavor dimension.
2 causes, each with a fix