A Template that should build and run on linux and windows arm64 in intellij idea without the kotlin-natives prebuilts error that you get with the new templates.
** DOES NOT WORK ON WINDOWS ARM64 IDEA ATM. only linux ** There is no build for org.jetbrains.compose.desktop:desktop-jvm-windows-arm64 yet so the true arm64 version of Intellij IDEA will not work. for now the only way to get it working is to use the x64 version of IDEA which doesnt seem to run too terribly emulated but you will notice it.
In Linux arm64 you may need to use this evironment variable to avoid crashes. Mine crashes anytime i try to use animations without this.
export MESA_EXTENSION_OVERRIDE="-GL_ARB_invalidate_subdata"
For example on Ubuntu to make this permanent you can edit ~/.profile and add it to the bottom.
To run on desktop youll need to add a config. at the top beside run hit add config
in the top right of the Run/Debug Config screen that pops up hit the plus symbol. Select gradle config in the name you can name it something like desktopApp Under run you want to put composeApp:run
After saving this config and hitting run you should end up with something like this
Building for IOS has been disabled so it will build on linux and windows. to enable it uncomment the section for IOS in the gradle build file in composeApp directory.
This is a Kotlin Multiplatform project targeting Android, iOS, Desktop.
-
/composeApp
is for code that will be shared across your Compose Multiplatform applications. It contains several subfolders:commonMain
is for code that’s common for all targets.- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
iosMain
would be the right folder for such calls.
-
/iosApp
contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.