https://kotlinlang.org logo
l

Luc Girardin

01/10/2023, 7:04 AM
Did any of you managed to get Compose for Desktop working with Kotlin 1.8.0? I am using:
Copy code
// <https://androidx.dev/storage/compose-compiler/repository>
// <https://github.com/JetBrains/compose-jb/issues/2108>
configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute(module("org.jetbrains.compose.compiler:compiler")).apply {
            using(module("androidx.compose.compiler:compiler:1.4.0-dev-k1.8.0-33c0ad36f83"))
        }
    }
}
but it fails with:
e: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.common.messages.MessageCollector.report$default(org.jetbrains.kotlin.cli.common.messages.MessageCollector, org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity, java.lang.String, org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation, int, java.lang.Object)'
l

Landry Norris

01/10/2023, 2:04 PM
compose-jb 1.2.2 provides a different way to specify the compose compiler.
Copy code
compose {
    this.kotlinCompilerPlugin.set("androidx.compose.compiler:compiler:1.4.0-dev-k1.8.0-33c0ad36f83")
}
I created a branch on an Android app using compose-jb that used this and upgraded to Kotlin 1.8.0, and everything worked fine in that project.
l

Luc Girardin

01/10/2023, 3:21 PM
Amazing, many thanks @Landry Norris: working smoothly on my side too (with a Compose Desktop) 🙂
l

Landry Norris

01/10/2023, 3:22 PM
I think Kotlin/Native 1.8 currently doesn’t work with that compiler version, but K/JVM should work fine.
l

Luc Girardin

01/10/2023, 4:39 PM
Correct!
240 Views