Hi! I'm getting started with compose, and I got th...
# compose-desktop
t
Hi! I'm getting started with compose, and I got this error on `Window`:
Copy code
Window(String = ..., IntSize = ..., IntOffset = ..., Boolean = ..., BufferedImage? = ..., MenuBar? = ..., Boolean = ..., Boolean = ..., WindowEvents = ..., (() -> Unit)? = ..., () -> Unit = ...): Unit' is only available since Kotlin 1.4.30 and cannot be used in Kotlin 1.4
This is my build.gradle.kts:
Copy code
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
	kotlin("jvm") version "1.4.30"
	id("org.jetbrains.compose") version "0.3.0-build153"
}

val mavenGroup = "com.theonlytails.jetpackcompose"

group = mavenGroup

repositories {
	jcenter()
	maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
}

dependencies {
	implementation(compose.desktop.currentOs)
}

compose.desktop {
	application {
		mainClass = "$mavenGroup.MainKt"

		nativeDistributions {
			targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
			packageName = mavenGroup
		}
	}
}
I have no idea what's wrong, or how to solve it. Looking at the list of dependencies, I can see kotlin 1.4.30 is there.
j
Are you seeing this when you do a build on the command line, or only seeing this in the IDE? Assuming you are seeing it in the IDE, it's probably because your IDE is using an old version of Kotlin, you should be able to open "Preferences" > "Languages & Frameworks" > "Kotlin", and then change the "Update Channel" to something which provides 1.4.30.
t
I have this:
Changing the channel does not bring any new versions.
j
Are you using the latest version of Intellij Idea?
t
Yes, with the latest EAP. I just checked for new updates.
j
This is what mine shows:
My IDE about page:
t
this is my about page:
That's so weird.
j
You could try downloading the latest stable IDEA instead of the latest EAP IDEA. Not sure if that'll help you, but it's conceivable the Kotlin update was only released for the stable branch.
Not sure what else to tell you, other than that your IDE somehow seems to not be using the latest Kotlin. The other issue is to just ignore the message, since it is just in your IDE and shouldn't impact the build, but it would be better to make your IDE happier.
t
I'll try to downgrade to the latest stable release and see if that helps.
d
a few ideas:
message has been deleted
message has been deleted
java 15 is not strictly necessary, only if you wanna build non-jvm based native executables
as a test I would try to build from the terminal
gradle clean build
y
I have also seen this error. It has been very hard for me to find a combination that actually works, between JNI core dumps, this error, and much more... I guess this is what "alpha" means. Right now the combination that has been working for me is kotlin 1.4.21 and compose 0.3.0-build141. Looks like on Mojave, you can't use a version more recent than 149 (see my posts about the jni core dumps...)
d
well my compose desktop app is coming up nicely with:
Copy code
plugins {
    kotlin("jvm")
    id("org.jetbrains.compose") version "0.3.0-build154"
    id("com.github.johnrengelman.shadow")
}

and

    implementation(compose.desktop.currentOs)

Gradle version: 6.8.2
Kotlin version: 1.4.30
javac  version: 11.0.10 (AdoptOpenJDK 11.0.10+9)
       srcComp: 11
       tgtComp: 11
versions of core dependencies:
  kotlin-stdlib-jdk8-1.4.30
  foundation-desktop-0.3.0-build154
MacOS BigSur
d
maybe try to "reset" your Intellij (just to be sure ...)