Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter Android build fails: module was compiled with an incompatible Kotlin version

ErrorModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16

Short 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.

  • Applies to Flutter 3.35, Gradle 8.x, Android Gradle Plugin 8.x, Kotlin Gradle plugin 2.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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/null
  2. 2Match what you see, then jump to its fix

    1. 1The 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. 2You 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

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/null

2Fix

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 --debug

Confirmed by docs.flutter.dev

Did this fix it?

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.gradle

2Fix

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 --debug

Confirmed by docs.flutter.dev

Did this fix it?

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:

Related fixes

Mobile 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 fix

Mobile 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.