I'm just trying to test a HelloWorld with KOtlin Multiplatform. I did it as described with the wizard. I can run the Android app and it works, but when I try to run the desktop main I get this error message.
Cannot locate tasks that match ':composeApp:compileJava' as task 'compileJava' is ambiguous in project ':composeApp'. Candidates are: 'compileDebugAndroidTestJavaWithJavac', 'compileDebugJavaWithJavac', 'compileDebugUnitTestJavaWithJavac', 'compileReleaseJavaWithJavac', 'compileReleaseUnitTestJavaWithJavac'.
* Try:
> Run gradle tasks to get a list of available tasks.
> For more on name expansion, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:name_abbreviation in the Gradle documentation.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 883ms
i also tried already the command gradle :composeApp:run or gradlew tasks but that doesn't work either, I get this error message:
gradlew : The name "gradlew" was not recognized as the name of a cmdlet, a function, a script file or an executable program. Check the spelling of the
name, or whether the path is correct (if included), and repeat the process.
In line:1 Character:1
+ gradlew tasks
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (gradlew:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
This same problem happened to me in a project with Kotlin Multiplatform on Windows 11.

Execute from PowerShell in the root path of the project the command
.\gradlew :composeApp:run

And for a better execution from Android Studio go to "Edit Configuration" of the gradle and set the command "composeApp:run" and the name of this new configuration.

I hope my answer has been helpful
Since gradle wasn't setup for me in windows (for android studio as default), it may be quicker/simpler to use:
.\gradlew :composeApp:run
(in android studio terminal in the project directory)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With