Pregunta

I'm trying to get a basic Hello World libgdx application running on the IPhone Simulator using gradle. I am new to gradle and robovm.

First I should note that I am able to successfully build and run tis example app https://github.com/jtakakura/robovm-sample-ios-app with the command:

./gradlew build launchIPhoneSimulator

Just as a small diversion, I am curious to know why

./gradlew launchIPhoneSimulator

fails. Apparently 'build' needs to be explicit.

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

I would have thought that the launchIPhoneSimulator task would depend on the build task and that calling lanuchIPhoneSimulator would implicitly invoke build. Is this a mistake in the gradle-robovm-plugin (https://github.com/jtakakura/gradle-robovm-plugin) or is there something I am missing about gradle?

Ok, sorry back to my main question:

I generated a libgdx project using the command line tool supplied by Gdx-setup (https://github.com/libgdx/libgdx/tree/master/extensions/gdx-setup) with the arguments:

--dir /Users/matt/code/test --name test --package com.foo.bar --mainClass FooTest

I threw the generated project up on github so you can clone it with less hassle:

git clone https://github.com/mattwalters/libgdx-test libgdx-test

Then I'll run

./gradlew build

to build all the sub projects. But I am unable to get the ios build running on the simulator via

./gradlew launchIPhoneSimulator

I get a similar error to the one above:

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

I double checked that there is no typo between the actual name of the main class and the mainClass declared to gradle. And there is indeed no classes directory in ios/build, but I am not sure why.

Can anyone help shed some light on this for me? Thanks very much in advance.

¿Fue útil?

Solución

Update 2014-01-24: At least one other user has verified that it now works, so please make sure you try again if you are still having problems.

Update 2014-01-23: I've recently checked in some bugfixes to the libgdx gradle support which has been merged into the daily builds. Assuming you use the daylies they should appear within 24 hours. At my end the new bugfixes makes "./gradlew ios:assemble launchIPhoneSimulator" work out of the box after creating a new project with the GdxSetup class.

Original response below:

First, make sure you use at least version 0.0.2 of the gradle-robovm-plugin. Secondly, try to build the sample project using the plugin from here:

https://github.com/jtakakura/robovm-sample-ios-app

The author of the plugin was kind enough to make this based on my request. I've tested the plugin with the example and it works without a hitch. It was discussed and resolved in a closed issue here:

https://github.com/jtakakura/gradle-robovm-plugin/issues/3

It's also worth noting that on recent libgdx builds, the command line tool for generating libgdx application templates already uses the plugin so you should be ready to go without the need to download and/or muck with the stuff yourself (short of getting libdx and running the command line util for generating a template project).

If you already have a project that you need to adapt, look carefully at the build.gradle file in the robovm-sample-ios-app example from the author of the example. It shows you what is needed to get a robovm build going.

Otros consejos

Try to check is roboVMVersion and robovm-gradle-plugin in your main build.gradle points to latest robovm/plugin versions. If no - try to use latest. This helps me several times.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top