klippp

I am trying to run the example SimpleTest1 from github but I am getting this error

Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 97
at com.esotericsoftware.spine.SkeletonBinary.readSkeletonData(SkeletonBinary.java:202)
at com.testPackage.SimpleTest1.create(SimpleTest1.java:69)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:150)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)

I just copy pasted the file but it doesn't run

Error on this line SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy-pro.skel"));

I am running version 3.8
klippp
  • Postovi: 4

Mario

> I just copy pasted the file

What file have you copied? The version of the skeleton file you try to load has to match the versiom of the runtime. Since you seem to have just started out with Spine, I strongoy suggest to use the latest Spine Editor and Runtimes version 4.0.
Avatar
Mario

Mario
  • Postovi: 3078

klippp

Mario je napisao/la:> I just copy pasted the file

What file have you copied? The version of the skeleton file you try to load has to match the versiom of the runtime. Since you seem to have just started out with Spine, I strongoy suggest to use the latest Spine Editor and Runtimes version 4.0.
I copied the file SimpleTest1.java from the spine-libgdx-test folder in the 3.8 branch on github. 3.8 is my editor and runtime version

---

I tried using version 4.0 as you said but now I get this error:
java.lang.IllegalArgumentException: No enum constant com.badlogic.gdx.graphics.Pixmap.Format.Linear
This is the same error I got with version 3.8 before adding the runtime files to the project, where exactly in my project do I have to put the runtime files? the gihub page just says to the contents of the src folder to the project but that doesn't work anymore, but it was working with version 3.8. Also is there a libgdx project using spine and gradle somewhere I cant just download and run?
klippp
  • Postovi: 4

Mario

Yeah, just copying the test sources and runtime files won't work. The runtime depends on libGDX. Please use Maven or Gradle with your project to manage dependencies. You can simply include everything that's needed by just adding the spine-libgdx dependency to your Maven or Gradle build.
https://github.com/EsotericSoftware/spine-runtimes/tree/4.0/spine-libgdx#maven--gradle
Avatar
Mario

Mario
  • Postovi: 3078

klippp

Mario je napisao/la:Yeah, just copying the test sources and runtime files won't work. The runtime depends on libGDX. Please use Maven or Gradle with your project to manage dependencies. You can simply include everything that's needed by just adding the spine-libgdx dependency to your Maven or Gradle build.
https://github.com/EsotericSoftware/spine-runtimes/tree/4.0/spine-libgdx#maven--gradle
I know. I added this: compile "com.esotericsoftware.spine:spine-libgdx:4.0.18.1" to the core project as it says in the github page but it still doesnt work, do I need to do anything after adding this line? I thought the github page said to add the contents of the src folder to your project but it's not working. I created the project using the libgdx setup tool.
klippp
  • Postovi: 4

Mario

If you've created a libgdx project via the setup tool, then you should have a gradle build that has everything you need in terms of libgdx. You can then copy over SimpleTest1 to your project. And finally, you need to add the spine-libgdx runtime.

You can do that by either copying the contents spine-runtimes/spine-libgdx/spine-libgdx/src to your project's core/src folder (so you end up with core/src/com/esotericsoftware/spine/), or you can add the dependency in your build.gradle file as you said you did.

If that still fails, then what I said in my first reply still holds: you are trying to load a .skel file exported from a Spine Editor version that is != the Spine Runtimes version you are using. That does not work. The versions have to match. If you use com.esotericsoftware.spine:spine-libgdx:4.0.18.1, then your skeleton must have been exported with Spine Editor version 4.0.x.
Avatar
Mario

Mario
  • Postovi: 3078

klippp

I got it working, I was creating the project using the setup tool I downloaded a long time ago. Using a newer version of libgdx seems to have worked. Thanks for the help.
klippp
  • Postovi: 4


Natrag na Runtimes