简体   繁体   English

此版本的 Compose Compiler 需要 Kotlin 版本 1.7.20,但您似乎使用的是 Kotlin 版本 1.8.0,不知道它是否兼容

[英]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.它对我有用,但可能有潜在的错误。

January 2023 2023 年 1 月

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.

相关问题 Dolphin IDE:Compose 编译器的此版本 (1.2.0-alpha05) 需要 Kotlin 版本 1.6.10,但您似乎使用的是 Z539A3A5859D26107FFDAZ 版本 1.6.16。 - Dolphin IDE: This version (1.2.0-alpha05) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.6.21 Compose Compiler 需要 Kotlin 版本 - Compose Compiler requires Kotlin version 当您是库开发人员时,Compose 编译器和 Kotlin 版本兼容性 - Compose Compiler and Kotlin version compatibility when you're library developer 项目需要最新版本的 Kotlin - Project requires latest version of Kotlin Kotlin:其元数据的二进制版本为1.8.0,预期版本为1.6.0 - Kotlin: The binary version of its metadata is 1.8.0, expected version is 1.6.0 使用不兼容版本 Kotlin 编译。其元数据的二进制版本为 1.8.0,预期版本为 1.6.0 - compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0 Gradle 找不到 kotlin 编译器版本 - Gradle can't find kotlin compiler version Kotlin 选择加入:此版本的编译器不支持标志 - Kotlin Opt-in: Flag is not supported by this version of the compiler 您正在使用的 compose 编译器插件(版本 1.0.1)需要 1.0.1 的最低运行时版本 - The compose compiler plugin you are using (version 1.0.1) expects a minimum runtime version of 1.0.1 Kotlin 版本问题 - Kotlin version issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM