Compose for native linux/windows app

Hello everyone!
I found out about Kotlin Multiplatform and Compose Multiplatform few days ago and as I understood I can develop native apps for Linux and Windows with it. It sounds cool so I started to try. But not succeed.

If I create project using KMP Wizard for Desktop it uses JVM as a target.
If I add linuxX64 or mingwX64 target, Gradle throws errors because Compose libraries don’t work with them. So I don’t understand how to use Compose for native build. Please help me. If you have project on github or just build.gradle.kts template that creates native build with UI for Linux or Windows, share it please, I really can’t find anything.

Compose unfortunately doesn’t support native desktop targets, only desktop JVM for now.

I would also absolutely love that, but it’s understandably a huge undertaking. JVM works pretty well though, and you can generate an installer with a bundled JVM for your app (Compose comes with the necessary Gradle tasks for that).

Obviously if you want to use the host system’s APIs that aren’t exposed by the JVM, you’ll have to reach out for JNI/JNA, (or build some sort of “host server” in a native language, that the client connects to), which isn’t great. More often than not, you’ll find ready Kotlin/Java libraries abstracting most things you’ll ever need.

Yeah. Thank you for the answer. Finally I found out that Desktop means Desktop JVM and that written in official documentation but i was confused that on Github supported platforms described as :

[iOS] (Beta)
[Android]
[Desktop] (Windows, MacOS, Linux)
[Web] (Alpha)

and I decided it means native support:)

1 Like