-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on execution from generate jar with gdx-backend-lwjgl3 and gdx-tools dependencies #4777
Comments
You can't include gdx-tools with lwjgl3 backend on dist, these are not compatible. see #3726 |
Indeed, gdx-tools project have both core, editor and test code. Editor and test code are based on Lwjgl backend. If you only need some Lwjgl agnostic classes (for instance texture packer), you can exclude Lwjgl from gdx-tools dependency in your gradle build, something like that (not tested) :
see https://docs.gradle.org/3.3/userguide/dependency_management.html#sub:exclude_transitive_dependencies This is just a workaround, IMO gdx-tools should be split in some way. Hope it's help. |
This comment was a godsend. For those finding this, the syntax is a little off. Try adding the following to your
|
I added it the following way, but still get the same error after gradlew clean dist and executing the jar.
|
@Amityville-DE There, you still depend on gdx-tools without the exclusion. You need to use: project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
// there was a problem line here.
api "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion"
api ("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
}
}
} Note that excluding LWJGL means not all of gdx-tools will be runnable. It can only use the parts of libGDX that don't rely on any platform implementation, and because parts of gdx-tools use AWT or Swing, those must be used on a desktop JVM (not a headless one). I don't think gdx-tools was ever intended for use at runtime, because it isn't built to run on Android or other non-desktop platforms. It of course can still be used at runtime, just limited to desktop JVMs and such. |
Issue details
When I generate a jar from a gdx projet with gdx-backend-lwjgl3 and gdx-tools dependencies and I try to run this jar, I have a error. The gdx application run perfectly with same configuration when I use Gradle to run this.
Reproduction steps/code
./gradlew clean dist
java -jar desktop/build/libs/desktop-1.0.jar
Version of LibGDX and/or relevant dependencies
1.9.6 with gdx-backend-lwjgl3 and gdx-tools dependencies
Stacktrace
Please select the affected platforms
The text was updated successfully, but these errors were encountered: