What issue is this? I am trying compose for deskto...
# compose-desktop
a
What issue is this? I am trying compose for desktop
Copy code
java.lang.IncompatibleClassChangeError: Found class org.jetbrains.kotlin.ir.declarations.IrClass, but interface was expected
	at androidx.compose.compiler.plugins.kotlin.VersionChecker.check(VersionChecker.kt:62)
	at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:42)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:93)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:89)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:91)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:106)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:595)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:211)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:154)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:386)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:110)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:286)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:99)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:114)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
	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(Native Method)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
🧵 1
j
That looks like you are trying to use incompatible versions of Kotlin and Compose. Please ensure you are using Compose 0.4.0 and Kotlin 1.5.10
a
Copy code
const val kotlinVersion = "1.4.30"
const val composeDesktopVersion = "0.3.1"
j
Yeah, I don't remember the compatibility tables that far back, but I'd suggest upgrading to
1.5.10
and
0.4.0
respectively.
a
Ok.. will try updating..
👍 1
j
Also, if you're looking for a simple hello-world example just to get yourself started, I might suggest starting with https://github.com/JetBrains/compose-jb/tree/master/templates/desktop-template
it is basically a hello-world example with essentially zero dependencies, so it tends to be the easiest place to get started
(and it is already using the latest versions of everything)
👍 1
but totally up to you if that's what you're looking for
a
actually I am tryting to add desktop module in KMM project..
j
a
After updating the version.. I added compose plugin in project build.gradle
Copy code
Could not find org.jetbrains.compose:compose-gradle-plugin:0.4.0.
Searched in the following locations:
  - <https://plugins.gradle.org/m2/org/jetbrains/compose/compose-gradle-plugin/0.4.0/compose-gradle-plugin-0.4.0.pom>
  - <https://dl.google.com/dl/android/maven2/org/jetbrains/compose/compose-gradle-plugin/0.4.0/compose-gradle-plugin-0.4.0.pom>
  - <https://repo.maven.apache.org/maven2/org/jetbrains/compose/compose-gradle-plugin/0.4.0/compose-gradle-plugin-0.4.0.pom>
t
@Aman Bansal Next time, please paste the stacktrace inside the thread like this 🙂 It'd make the channel clean
👍 1
k
Do you have
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
which is where compose-desktop binaries are?
j
In particular, you'll need the
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
in your root gradle file, maybe in the buildscript block. That is to say, the maven repository needs to appear in two different places in your gradle configuration.
a
Copy code
allprojects {
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven { url = uri("<https://maven.pkg.jetbrains.space/public/p/compose/dev>") }
    }
}
I have it in both root gradle and settings.gradle
my bad, it wasn't present in buildscript block..