提问人:Canjo 提问时间:11/14/2023 更新时间:11/14/2023 访问量:37
Kotlin Multiplatform, desktopMain 无法执行
Kotlin Multiplatform, desktopMain cannot be executed
问:
我只是想用 KOtlin Multiplatform 测试一个 HelloWorld。我按照向导的描述做了。我可以运行 Android 应用程序并且可以正常工作,但是当我尝试运行桌面主设备时,我收到此错误消息。
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
我也已经尝试了该命令,或者这也不起作用,我收到此错误消息:gradle :composeApp:run
gradlew tasks
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
答:
0赞
Canjo
11/14/2023
#1
我已经为所有使用 Windows 的人提供了它。之前我只是在终端中编写此命令并收到错误消息。
现在我在 Run Anything(用 2*strg 打开)中编写了命令 gradle :composeApp:run
,它可以工作。
评论
1赞
k314159
11/14/2023
对于那些不会说德语的人来说,“strg”是 CTRL 键。
0赞
AndyS
12/20/2023
#2
由于 gradle 不是在 Windows 中为我设置的(默认为 android studio),因此使用起来可能更快/更简单:
.\gradlew :composeApp:run
(在 Android Studio 终端的项目目录中)
评论