Does anyone know why this issue occurs whenever I ...
# multiplatform
s
Does anyone know why this issue occurs whenever I try to run a Compose Desktop application in a Kotlin Multiplatform project using the Run button? I'm using Android studio and I have also defined main class under application { } configuration block of compose.desktop { }.
p
I think you need to run it via Gradle command, the run doesn't work. https://stackoverflow.com/questions/77480498/kotlin-multiplatform-desktopmain-cannot-be-executed
t
AFAIK it should be fixed in Android Studio N Canary 1. If not - please open an issue: https://kotl.in/issue
s
You can definitely use the Run button to launch your Compose Desktop app, you just need to configure a gradle launch configuration that executes the Desktop task. By default, I’m pretty sure it’s something like
./gradlew :composeApp:run
You’ll need to make sure your desktop configuration is setup in build.gradle.kts, then you can ask gradle to list the tasks and execute the one for desktop, then make a new run configuration with that command.
s
Yes it works if I command but why run button doesn't work??
s
I mean from that screenshot it looks that your run configuration is that you’re trying to hit the main method, instead of a gradle configuration