Flutter Module 是使用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是1.8.0,预期版本是1.6.0

问题描述 投票:0回答:2

在颤抖中

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

格式化系统后安装Android Studio - Chipmunk | 2021.2.1 补丁 2 Kotlin 版本 - 212-1.6.10-release-923-AS5457.46

Flutter 版本 3.7.3 和 Dart 版本 2.19.2

试过了

  • 使缓存失效
  • 清理gradle文件
  • 在 Android Studio 中,您可以转到 Build -> Clean Project
  • flutter clean,flutter pub get
  • 还从系统格式化了操作系统并重新安装了

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

解决问题的详细步骤答案

flutter android-studio build.gradle
2个回答
6
投票

我们面临同样的问题,我们的项目停滞了一整周,

RCA:

该问题是由于我们在 flutter 包版本前面添加了 ^ 引起的。因此,pubspec.lock 已使用最新版本的软件包进行了修改。

解决方案:

我们从版本中删除了 ^ 并按照以下步骤操作

  1. flutter pub 缓存清理
  2. 删除 pubspec.lock
  3. flutter 酒吧获取

这导致使用 pubspec.yaml 中提到的包的确切版本再次生成 pubspec.lock


0
投票

kotlin
中将
android/build.gradle
版本更改为1.6.0或以上。

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

buildscript {
    ext.kotlin_version = '1.7.10' // update kotlin version
    repositories {
        google()
        jcenter()
    }
© www.soinside.com 2019 - 2024. All rights reserved.