在颤抖中
** 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
试过了
[✓] 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
解决问题的详细步骤答案
我们面临同样的问题,我们的项目停滞了一整周,
RCA:
该问题是由于我们在 flutter 包版本前面添加了 ^ 引起的。因此,pubspec.lock 已使用最新版本的软件包进行了修改。
解决方案:
我们从版本中删除了 ^ 并按照以下步骤操作
这导致使用 pubspec.yaml 中提到的包的确切版本再次生成 pubspec.lock
在
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()
}