[英]This version Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.8.0 which is not known to be compatible
if you get this error in android studio "This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.8.0 which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck
but don't say I didn't warn you.)."如果您在 android studio 中遇到此错误“此版本 (1.3.2) 的 Compose 编译器需要 Kotlin 版本 1.7.20,但您似乎使用的是 Kotlin 版本 1.8.0,但未知是否兼容。请修复您的配置 (或
suppressKotlinVersionCompatibilityCheck
但不要说我没有警告你。)”
I suppose so.我想是这样。 I encountered the same problem.
我遇到了同样的问题。 And here is another solution I learned from someone.
这是我从某人那里学到的另一个解决方案。 Add this to module build.gradle in kotlinOptions {}.
将其添加到 kotlinOptions {} 中的模块 build.gradle。 It is like this:
是这样的:
kotlinOptions {
// other configurations
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"]
}
It works for me, but might have potential bugs.它对我有用,但可能有潜在的错误。
The Latest version (1.4.0-alpha02) of Compose-UI works against Kotlin 1.7.21. Compose-UI 的最新版本 (1.4.0-alpha02) 适用于 Kotlin 1.7.21。
You have to force it, suppress the warnings, and potentially deal with any incompatibility, or wait for a new Compose release updated for Kotlin 1.8.x.您必须强制执行它、抑制警告并可能处理任何不兼容问题,或者等待针对 Kotlin 1.8.x 更新的新 Compose 版本。
You can track the compatibility between Compose and Kotlin in the Compose to Kotlin Compatibility Map page.您可以在 Compose 与Kotlin 兼容性 Map页面中跟踪 Compose 与 Kotlin 之间的兼容性。
I came across the same issue just now.我刚才遇到了同样的问题。 I resolved this issue by referencing the latest
Compose
compiler version from the Android Developer Jetpack page .我通过引用Android Developer Jetpack 页面中的最新
Compose
编译器版本解决了这个问题。
Here is the summary of the implementation(with a larger explanation via their page):这是实施的摘要(通过他们的页面有更大的解释):
// :app build.gradle
android {
...
composeOptions {
kotlinCompilerExtensionVersion = "1.4.0"
}
kotlinOptions {
jvmTarget = '1.8'
}
}
After that I just synced and resolved any errors that showed up in my .kt
files.之后我只是同步并解决了我的
.kt
文件中出现的任何错误。 Android Studio never picked up on the alpha variants of the compiler for me in build.gradle
. Android Studio 从未在
build.gradle
中为我挑选编译器的 alpha 变体。
This is because the Kotlin version has been updated but the Compos version has not been updated.这是因为Kotlin版本已经更新,而Compos版本还没有更新。 So we have to wait for the new version of Compose.
所以我们必须等待新版本的 Compose。 If I am wrong, others correct me.
如果我错了,其他人会纠正我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.