You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

解决Kotlin多平台项目中“Some Kotlin runtime libraries and <x> other jars have unsupported binary format”报错

解决Kotlin多平台项目中“Some Kotlin runtime libraries and other jars have unsupported binary format”报错

我是Kotlin Gradle的新手,最近用Kotlin Multiplatform Wizard创建了一个面向Desktop和Web的多平台项目,下载后导入IntelliJ IDEA,结果打开自动生成的文件时弹出了这个奇怪的错误:

Some Kotlin runtime libraries and other jars have unsupported binary format

点击详情后,看到提示说期望Kotlin版本为1.9.0,但我的项目里向导默认用的是Kotlin 2.2.0。

虽然项目能正常编译和运行,但IntelliJ一直报这个错,给开发带来了不少麻烦。我之前找到过类似的问题,有人建议把Kotlin编译器版本从2.2.0降级到2.0.0,但试了之后还是没解决IDE的报错问题。

下面是向导自动生成的libs.versions.toml文件内容:

[versions]
androidx-lifecycle = "2.9.4"
composeHotReload = "1.0.0-beta07"
composeMultiplatform = "1.9.0"
junit = "4.13.2"
kotlin = "2.2.0"
kotlinx-coroutines = "1.10.2"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-testJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
junit = { module = "junit:junit", version.ref = "junit" }
androidx-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
kotlinx-coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }

[plugins]
composeHotReload = { id = "org.jetbrains.compose.hot-reload", version.ref = "composeHotReload" }
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" }
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

有没有大佬能帮忙解决这个IDE报错的问题呀?

火山引擎 最新活动