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.

Andriod编译出现错误:

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.

大概含义就是用错了Kotlin语言的版本,模块是用不兼容的Kotlin版本编译的,其元数据的二进制版本为1.8.0,预期版本为1.6.0
在build.gradle中,添加Kotlin语言Gradle插件,高于上面报错提示的1.6.0版本即可,例如:

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0'

在app/build.gradle -> android中添加以下配置:

implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.0"

如果确定代码没问题,可以在app/build.gradle -> android中添加以下配置:

lintOptions{
  checkReleaseBuilds false
  abortOnError false
}

posted on 2024-04-02 12:00  陈德彪  阅读(3439)  评论(0)    收藏  举报

导航