flutterandroid-studiobuild.gradle

Flutter 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


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


[✓] 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


Solution

  • We faced the same issue and our project was at a standstill 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