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.

发布时间 2024-01-06 15:57:14作者: lude1994
Launching lib/main.dart on 22011211C in debug mode...
e: /Users/mm/.gradle/caches/transforms-3/37865fb99fa1fb60cf850910df4bb8bf/transformed/jetified-kotlin-stdlib-common-1.8.22.jar!/META-INF/kotlin-stdlib-common.kotlin_module: 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.
e: /Users/mm/.gradle/caches/transforms-3/90743e4880f494e80265cab0c2cb7133/transformed/core-1.10.1-api.jar!/META-INF/core_release.kotlin_module: 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.
e: /Users/mm/.gradle/caches/transforms-3/c7d7437969d55499b1e0447597d55b67/transformed/jetified-annotation-jvm-1.6.0.jar!/META-INF/annotation.kotlin_module: 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.
e: /Users/mm/.gradle/caches/transforms-3/ed8e633700fbda5f13279e2da1611347/transformed/jetified-kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: 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.
e: /Users/mm/.gradle/caches/transforms-3/ed8e633700fbda5f13279e2da1611347/transformed/jetified-kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: 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.
e: /Users/mm/.gradle/caches/transforms-3/ed8e633700fbda5f13279e2da1611347/transformed/jetified-kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib.kotlin_module: 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.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

解决方法:

  1.我下载了最新的kotlin版本的包1.9,下载地址:https://plugins.jetbrains.com/plugin/6954-kotlin/versions#tabs

  2.在android studio中左上角(preferences)按图导入下载的kotlin文件。   -----这一步不知道有没有必要,因为我是先走了这步操作。   

 

3.修改android下的build.gradle

 

我成功了