Closed abueide closed 4 years ago
Which LibGDX version do you use and which LibKTX version did you add?
If you're using LibGDX 1.9.11, add LibKTX 1.9.11-b1. If you're still on 1.9.10, consider updating or add 1.9.10-b7. You can find LibGDX compatibility table for VisUI here.
Judging by the stack trace, the error is caused by compilation of the default sprite batch shader here:
at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:162)
This is really weird, it seems like you have incompatible versions of the LibGDX core library and the desktop implementation. I'd refresh and verify the Gradle setup, as I'm not sure if that's a KTX issue.
I'm using libgdx 1.9.11 and libktx 1.9.11-b1. Every other library in the build.gradle works fine except for this one, and they're all using the same version variable.
core/build.gradle
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
eclipse.project.name = appName + '-core'
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "net.onedaybeard.artemis:artemis-odb:$artemisVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
api "io.github.libktx:ktx-freetype:$ktxVersion"
api "io.github.libktx:ktx-freetype-async:$ktxVersion"
api "io.github.libktx:ktx-collections:$ktxVersion"
api "io.github.libktx:ktx-inject:$ktxVersion"
api "io.github.libktx:ktx-tiled:$ktxVersion"
api "io.github.libktx:ktx-math:$ktxVersion"
api "io.github.libktx:ktx-actors:$ktxVersion"
api "io.github.libktx:ktx-scene2d:$ktxVersion"
// Uncommenting breaks
// api "io.github.libktx:ktx-vis:$ktxVersion"
// api "io.github.libktx:ktx-vis-style:$ktxVersion"
api "io.github.libktx:ktx-preferences:$ktxVersion"
api "io.github.libktx:ktx-app:$ktxVersion"
api "io.github.libktx:ktx-assets:$ktxVersion"
api "io.github.libktx:ktx-assets-async:$ktxVersion"
api "io.github.libktx:ktx-graphics:$ktxVersion"
api "io.github.libktx:ktx-i18n:$ktxVersion"
api "io.github.libktx:ktx-log:$ktxVersion"
}
The only thing I do to go from a running working version is uncommenting the ktx-vis line gradle.properties
org.gradle.daemon=false
org.gradle.jvmargs=-Xms512M -Xmx4G -XX:MaxPermSize=1G -XX:MaxMetaspaceSize=1G
org.gradle.configureondemand=false
kotlinVersion=1.3.+
gdxVersion=1.9.11-SNAPSHOT
ktxVersion=1.9.11-b1
coroutinesVersion=1.3.7
artemisVersion=2.3.0
aiVersion=1.8.2
box2dlightsVersion=1.5
squidLibExtraVersion=76aa10749b
squidLibUtilVersion=76aa10749b
regExodusVersion=0.1.10
noise4jVersion=0.1.0
tenPatchVersion=5.0.0
squidLibVersion=76aa10749b
anim8Version=0.1.4
@abueide Could you try adding VisUI to your dependencies (without ktx-vis
) and check if the issue persists?
compile "com.kotcrab.vis:vis-ui:1.4.6"
ah i get the same issue with that, here is the project btw https://github.com/ugdt/gdxcrawler/tree/gui
@kotcrab I think there's an issue with VisUI 1.4.6.
@abueide I'm unable to reproduce the issue with the repository that you've provided. After checking out gui
branch, I did get an unrelated exception, but nothing similar to the one you experienced:
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: No com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle registered with name: default-horizontal
at com.badlogic.gdx.scenes.scene2d.ui.Skin.get(Skin.java:162)
at com.badlogic.gdx.scenes.scene2d.ui.ProgressBar.<init>(ProgressBar.java:61)
at com.abysl.gdxcrawler.screens.game.GameHud.healthBar(GameHud.kt:32)
at com.abysl.gdxcrawler.screens.game.GameHud.<init>(GameHud.kt:13)
at com.abysl.gdxcrawler.screens.game.GameScreen.<init>(GameScreen.kt:29)
at com.abysl.gdxcrawler.Game.create(Game.kt:18)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:433)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:381)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:138)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:114)
at com.abysl.gdxcrawler.desktop.Lwjgl3Launcher.createApplication(Lwjgl3Launcher.kt:15)
at com.abysl.gdxcrawler.desktop.Lwjgl3Launcher.main(Lwjgl3Launcher.kt:11)
It seems that you're using a progress bar without a defined style. After commenting the health bar line, I got the application running:
My best guess is that your Gradle setup needs refreshing. I'd assume the LibGDX desktop natives library is out of sync with the core library. Try running this:
./gradlew clean build --refresh-dependencies
If that doesn't help, removing Gradle cache won't hurt:
rm -rf $HOME/.gradle/caches/
I did both suggestions, cloned the project from github in a new directory, switched to gui branch and I'm still getting the same error, with gradlew and the installed version of gradle 6.5.1. I'm on windows. What platform/gradle version do you use? And yeah the skin error is supposed to happen, i'm in the middle of trying to make a gui and ran into this error, so I haven't added a skin yet.
Linux Mint, Gradle 5.6.4. I'm not sure what to do, this seems to be VisUI-related since the error is caused even if you add it without the KTX wrapper. You could try using Gradle 5, but somehow I don't think it will help. You can create an issue in VisUI repo, maybe someone experienced similar problems or can reproduce your issue.
I agree, this isn't a ktx problem, thanks for your help in narrowing it down. Even knowing that you can't reproduce it is helpful, thanks a ton.
@abueide I've heard that LibGDX Discord is pretty active. VisUI is a pretty popular library, someone could have experienced similar issues.
Was only broken on my machine. Fixed by deleting ~/.gradle and ~/.m2 directories and letting it refresh.
That's what I initially suspected. Glad you managed to figure it out.
added to core/build.gradle api "io.github.libktx:ktx-vis:$ktxVersion"
stacktrace: