Kelvin Ojiako
05/02/2023, 9:00 PMIncompatibleComposeRuntimeVersionException
, I will attach more details of my build file in the replies. So I was following this example for manually creating a compose HTML project from a kotlin multiplatform project. Its a bit confusing cause I already added the runtime but it does not seem to work. Would really appreciate some help. Added 2 replies to my post showing my build file and the full errors about the runtime not being on the classpathplugins *{*
_kotlin_("multiplatform") _version_ "1.8.20"
id("org.jetbrains.compose") _version_ "1.4.0"
application
}
_group_ = "me.kso170000"
_version_ = "1.0-SNAPSHOT"
_repositories_ *{*
jcenter()
mavenCentral()
_maven_("<https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven>")
_maven_("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
google()
}
_kotlin_ *{*
jvm("backend") *{*
jvmToolchain(11)
withJava()
testRuns["test"].executionTask.configure *{*
useJUnitPlatform()
}
}
js("frontend", IR) *{*
binaries.executable()
browser *{*
commonWebpackConfig *{*
cssSupport *{*
enabled.set(true)
}
}
}
}
_sourceSets_ *{*
val commonMain by _getting_
val commonTest by _getting_ *{*
dependencies *{*
implementation(kotlin("test"))
}
}
val backendMain by _getting_ *{*
dependencies *{*
implementation("io.ktor:ktor-server-netty:2.0.2")
implementation("io.ktor:ktor-server-html-builder-jvm:2.0.2")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
}
}
val backendTest by _getting_
val frontendMain by _getting_ *{*
dependencies *{*
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.9.3-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom:6.3.0-pre.346")
implementation(_compose_.html.core)
implementation(_compose_.runtime)
}
}
val frontendTest by _getting_
}
}
_application_ *{*
_mainClass_.set("me.kso170000.application.ServerKt")
}
_tasks_._named_<Copy>("backendProcessResources") *{*
val frontendBrowserDistribution = _tasks_.named("frontendBrowserDistribution")
from(frontendBrowserDistribution)
}
_tasks_._named_<JavaExec>("run") *{*
dependsOn(_tasks_._named_<Jar>("backendJar"))
classpath(_tasks_._named_<Jar>("backendJar"))
}
``` androidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: The Compose Compiler requires the Compose Runtime to be on the class path, but none could be found. The compose compiler plugin you are using (version 1.4.5) expects a minimum runtime version of 1.0.0 at androidx.compose.compiler.plugins.kotlin.VersionChecker.noRuntimeOnClasspathError(VersionChecker.kt:168)
at androidx.compose.compiler.plugins.kotlin.VersionChecker.check(VersionChecker.kt:145)
at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:69)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$lambda$0(JvmIrCodegenFactory.kt:190)
at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:107)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:224)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:57)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.convertToIr(KotlinToJVMBytecodeCompiler.kt:225)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:102)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:495)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:133)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:486)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:409)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:290)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:112)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:627)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1587)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Errors were stored into C:\Users\kso170000\IdeaProjects\sampleExperiment\.gradle\kotlin\errors\errors-1683060548247.log```
Tuna
05/02/2023, 10:47 PM```
for the code block.Dima Avdeev
05/03/2023, 7:12 AMOleksandr Karpovich [JB]
05/03/2023, 7:56 AMid(“org.jetbrains.compose”) gradle plugin enables Compose for all targets declared inThe Compose Compiler requires the Compose Runtime to be on the class path
_kotlin_ *{}*
block. So to jvm(“backend”) too.
I guess adding implementation(compose.runtime)
in your backendMain.dependencies should help.
If it’s not desirable, I think splitting into different modules could be an option:
• Module “shared” - common code for frontend and backend, doesn’t depend on compose
• Module “backend” - depends on shared, but doesn’t depend on compose
• Module “frontend” - depends on shared, and depends on composeKelvin Ojiako
05/03/2023, 10:26 PM