• Runtimes
  • [LibGDX] problem with readSkeletonData on AndroidStudio

Hello All, I am newy user of Spine and I am interested to see the examples available for load the animation on libgdx.
using the simpleTest1 example on android studio, however I do not know if my configuration is wrong, but it is giving me the following error:

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

this error is from the create method:

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

about my configurarion, I just generate a new project using libgdx, put the assets on folder (android/assets)
putting all the code of simpleTest1.java on my MainClass.java.

I cant figure why is throwing this error. I search a little about this kind of error but only say is because the Skeleton was exported with a old version of Spine, and Since I have the Spine ESS version, i dont know if I can expor it.
(Sorry my bad english)

Related Discussions
...

You need to export your .skel file from the version of Spine that matches the runtimes you are using. So if you are using the 3.8 runtimes, open your project in the latest version of 3.8 and export the binary skeleton data. This works the same for Spine Essential and Spine Professional.

Nate wrote

You need to export your .skel file from the version of Spine that matches the runtimes you are using. So if you are using the 3.8 runtimes, open your project in the latest version of 3.8 and export the binary skeleton data. This works the same for Spine Essential and Spine Professional.

Hello, thank you very much for your answer, it just coincides that looking more deeply at things, the problem is the libgdx project generator. this create the prpyect with old versions of gradle and spine plugin, i just update the:

graddle.build from 3.6 to
api "com.esotericsoftware.spine:spine-libgdx:3.8.55.1"


the proyec structure:
android graddle plugin to 4.0.1
and gradle version to 6.6.1

but now i am having a new error at render method. this says:

Exception in thread "LWJGL Application" java.lang.RuntimeException: SpriteBatch cannot render meshes, PolygonSpriteBatch or TwoColorPolygonBatch is required.
   at com.esotericsoftware.spine.SkeletonRenderer.draw(SkeletonRenderer.java:133)
   at com.mygdx.spine.MainClass.render(MainClass.java:100)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:232)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)

oks i going to try the export skel 🙂

Oh, glad you figure that out. For the next error, you need to use a PolygonSpriteBatch or TwoColorPolygonBatch if you are rendering meshes, not a SpriteBatch.

is not posible export a Pro proyect with Ess version 🙁



Edit: problem solved

Nate wrote

Oh, glad you figure that out. For the next error, you need to use a PolygonSpriteBatch or TwoColorPolygonBatch if you are rendering meshes, not a SpriteBatch.

yay this work! ty very much 🙂. since i am newy and just trying to run the examples, i dont knew if i am using normal textures or meshes :upsidedown: