【发布时间】:2023-03-29 01:56:01
【问题描述】:
我正在尝试使用 gradle 在 iPhone 模拟器上运行一个基本的 Hello World libgdx 应用程序。我是 gradle 和 robovm 的新手。
首先我应该注意,我可以使用以下命令成功构建和运行示例应用程序https://github.com/jtakakura/robovm-sample-ios-app:
./gradlew build launchIPhoneSimulator
只是作为一个小消遣,我很想知道为什么
./gradlew launchIPhoneSimulator
失败。显然“构建”需要明确。
wintermute:robovm-sample-ios-app matt$ ./gradlew launchIPhoneSimulator
:launchIPhoneSimulator
Classpath entry /Users/matt/code/robovm-sample-ios-app/build/classes/main does not exist
:launchIPhoneSimulator FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launchIPhoneSimulator'.
> Main class org.robovm.sample.ios.RoboVMSampleIOSApp not found
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.115 secs
我原以为 launchIPhoneSimulator 任务将依赖于构建任务,调用 lanuchIPhoneSimulator 会隐式调用构建。这是 gradle-robovm-plugin (https://github.com/jtakakura/gradle-robovm-plugin) 中的一个错误,还是我对 gradle 遗漏了什么?
好的,抱歉回到我的主要问题:
我使用 Gdx-setup (https://github.com/libgdx/libgdx/tree/master/extensions/gdx-setup) 提供的命令行工具生成了一个 libgdx 项目,并带有参数:
--dir /Users/matt/code/test --name test --package com.foo.bar --mainClass FooTest
我将生成的项目放到了 github 上,这样你就可以轻松地克隆它:
git clone https://github.com/mattwalters/libgdx-test libgdx-test
那我就跑
./gradlew build
构建所有子项目。但我无法通过
让 ios 构建在模拟器上运行./gradlew launchIPhoneSimulator
我收到与上述类似的错误:
wintermute:test matt$ ./gradlew ios:launchIPhoneSimulator
:ios:launchIPhoneSimulator
Classpath entry /Users/matt/code/test/ios/build/classes/main does not exist
:ios:launchIPhoneSimulator FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ios:launchIPhoneSimulator'.
> Main class com.foo.bar.IOSLauncher not found
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.759 secs
我仔细检查了主类的实际名称和声明为 gradle 的 mainClass 之间没有拼写错误。而且ios/build里面确实没有classes目录,但是不知道为什么。
谁能帮我解释一下这个问题?提前非常感谢。
【问题讨论】:
标签: ios gradle libgdx gradlew robovm