I am running into a compile error when trying to compile a project with Kotlin and Compose Multiplatform, I think due to the Compose 1.1.0 compiler extension not being compatible with Kotlin 1.6.21. Even though I set my Kotlin plugin version to 1.6.10:
plugins {
idea
kotlin("jvm") version "1.6.10"
id("org.jetbrains.compose") version "1.1.0"
}
I get this error:
Kotlin: kotlinc-jvm 1.6.21-release-334 (JRE 15 36-1562)
Kotlin: [Internal Error] java.lang.IllegalStateException: The provided plugin androidx.compose.compiler.plugins.kotlin.ComposeComponentRegistrar is not compatible with this version of compiler
I can't figure out how to set the version of the Kotlin compiler that is used. From the log above the error, I can see it's using version 1.6.21-release-334, rather than some 1.6.10 version.
An alternate possible solution would be to change the version of the Compose Kotlin Compliler plugin to a more recent alpha or beta version that supports Kotlin 1.6.21, but I can't figure out how to do that either. In an Android project, you would use:
android {
composeOptions {
kotlinCompilerExtensionVersion = "1.2.0-beta03"
}
}
However, I would rather solve this by setting the Kotlin compiler so I won't run into the issue again whenever the latest version of Kotlin outpaces the compatibility of the Compose Multiplatform Kotlin Compiler Plugin.
CodePudding user response:
The main idea I was thinking about is that there are some other places in the existing project where the old version 1.6.21
was used or some other setups that require that version or maybe an old cache. So basically need to clean the project, even delete the .idea
directory of the project, and check other places where the old version can be set. After that reopen the project, do cleanup, sync and rebuild it.