Fix issue: Module was compiled with an incompatible version of Kotlin

227 阅读1分钟

Error

背景:写完一段 compose 代码编译后报错,新增的代码太多了不知道是哪的 error

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

Solution

  • 查看依赖树
./gradlew app:dependencies >> dp.txt

全局搜索:1.8.10, 破案了,狗日的 com.google.accompanist:accompanist-swiperefresh 导致的问题:

+--- com.google.accompanist:accompanist-swiperefresh:0.30.1
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10 (*)
  • 查看 accompanist-swiperefresh 文档选择与 compose 版本对应的版本:

github.com/google/acco…

image.png