无法找到与 ':composeApp:compileJava' 匹配的任务,因为任务 'compileJava' 在项目 ':composeApp' 中不明确

Dev*_*ngh 9 kotlin-multiplatform android-jetpack-compose

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 189ms
Run Code Online (Sandbox Code Playgroud)

我从 jetbrains 网站创建了该项目。

Dew*_*eed 29

它看起来像是模板中的错误。根据Multiplatform: Cannot locatedtasks that match ':composeApp:compileJava'gradle :composeApp:run从 Run Anything 调用可以在我的机器上工作。


Amj*_*reh 5

如果您在 Mac 上使用 Android Studio,请从终端输入: ./gradlew :composeApp:run