不对应报错
This version (1.5.1) of the Compose Compiler requires Kotlin version 1.9.0 but you appear to be using Kotlin version 1.9.23 which is not known to be compatible. Please consult the Compose-Kotlin compatibility map located at https://developer.android.com/jetpack/androidx/releases/compose-kotlin to choose a compatible version pair (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
composeOptions { kotlinCompilerExtensionVersion = "1.5.1" }
解决方式:升级Compose版本到1.5.31 看下关系对应表
对应关系
官网对应关系表
https://developer.android.com/jetpack/androidx/releases/compose-kotlin?hl=zh-cn
https://developer.android.com/jetpack/androidx/releases/compose-kotlin?hl=zh-cn
https://developer.android.com/jetpack/androidx/releases/compose-kotlin
Kotlin插件
位置:顶级Project build.gradle配置插件(通过名字可以判断)
plugins { id 'org.jetbrains.kotlin.android' version '1.9.22' apply false }
Compose版本
位置:在模块下的build.gradle(app)
composeOptions { kotlinCompilerExtensionVersion = "1.5.10" }