skip to Main Content

In flutter getting ** Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.**

After formatting the system installed Android Studio – Chipmunk | 2021.2.1 Patch 2
Kotlin version – 212-1.6.10-release-923-AS5457.46

Flutter version 3.7.3 and Dart version 2.19.2

Have tried

  • Invalidating cache
  • Cleaning gradle files
  • In Android Studio, you can go to Build -> Clean Project
  • flutter clean, flutter pub get
  • Have also formatted the OS from the system and reinstalled

[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6.6 21G646 darwin-x64, locale
    en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Detailed Step by step answer to resolve the issue

2

Answers


  1. Change kotlin version to 1.6.0 or above in android/build.gradle.

    kotlin-version https://docs.flutter.dev/release/breaking-changes/kotlin-version

    buildscript {
        ext.kotlin_version = '1.7.10' // update kotlin version
        repositories {
            google()
            jcenter()
        }
    
    Login or Signup to reply.
  2. We faced the same issue and our project was at a stand still for a whole week,

    RCA:

    The issue was caused because of the ^ we add in front of the flutter package versions. Due to which the pubspec.lock got modified with a latest version of the packages.

    Solution:

    We removed the ^ from the versions and followed below steps

    1. flutter pub cache clean
    2. delete pubspec.lock
    3. flutter pub get

    this resulted in the pubspec.lock being generated again with the exact versions of the packages mentioned in the pubspec.yaml

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search