Windows 11
I failed to import some .skel file into Spine, they give the same error message, I want to know what happened and how can I manage to import them into Spine,very much thanks.
ER

hero-xinghe-pf2skel.bytes
142kB

ROR: Error importing skeleton:
java.lang.IllegalArgumentException: newSize must be >= 0: -1
at gq.C(SourceFile:499)
at gq.I(SourceFile:401)
at jV.C(SourceFile:316)
at kR.C(SourceFile:136)
at wL.C(SourceFile:310)
at wV.run(SourceFile:274)
at uD.Z(SourceFile:1648)
at wh.I(SourceFile:379)
at eD.C(SourceFile:92)
at fO.C(SourceFile:28)
at dT.C(SourceFile:188)
at dT.C(SourceFile:158)
at com.badlogic.gdx.scenes.scene2d.ui.Button.I(SourceFile:131)
at ew.C(SourceFile:94)
at fQ.C(SourceFile:88)
at dZ.C(SourceFile:59)
at eb.I(SourceFile:351)
at Prn.I(SourceFile:124)
at t.C(SourceFile:360)
at f.run(SourceFile:259)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Related Discussions
...

The error you are encountering when trying to import the .skel file into Spine is likely due to a version mismatch between the exported .skel file and the version of Spine you are using. Here are the steps you can follow to resolve this issue:

  1. Identify the Version: Open the .skel file in a text editor and look for the version number near the beginning of the file. It will look something like 3.5.51 or 3.8.81.

  2. Downgrade Spine: Set your Spine editor to the version that matches the version number found in the .skel file. You can do this by going to the Spine settings and selecting the appropriate version. For example, if the version is 3.8.81, you need to run Spine with that version.

  3. Import and Save: Import the .skel file in the downgraded version of Spine. Once imported, save the project as a .spine file.

  4. Upgrade and Export: Open the saved .spine project file in the latest version of Spine or the version that matches your runtime. Then, export the project as a JSON or binary file that works with your runtime.

Here are some useful links for more detailed instructions:

If the .skel file contains meshes and you are using Spine Essential, you will need to upgrade to Spine Professional to view, edit, or export them correctly.

If you continue to experience issues, it might be due to the .skel file being exported without nonessential data, which can cause problems with meshes. In such cases, you may need to contact the original creator for the .spine project file or ensure that the source images do not have padding around them.

Thanks for your answer.But I have checked the version already, it is 3.8.79 and I have tested the Spine could successfully open other .skel file of this 3.8.79 version.
I extracted them from a mobile game and all these .skel files are made of 3.8.79 version, but some of them can not be opened, while some of them could be opened. I would like to know why the error happen and how can I fix this problem, Many thanks again.

This could be a bug in the very old 3.8.79 version, or it could be binary skeleton data the is corrupt. I tried with 3.8.99 and it also can't be imported. I tried with 3.8.99 Skeleton Viewer and got the same error, unobfuscated:

IllegalArgumentException: newSize must be >= 0: -1
        at com.badlogic.gdx.utils.Array.truncate(Array.java:508)
        at com.badlogic.gdx.utils.Array.setSize(Array.java:410)
        at com.esotericsoftware.spine.SkeletonBinary.readSkeletonData(SkeletonBinary.java:318)
        at com.esotericsoftware.spine.SkeletonViewer.loadSkeleton(SkeletonViewer.java:224)

The line that fails:
EsotericSoftware/spine-runtimesblob/3.8/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java#L318

o = skeletonData.animations.setSize(n = input.readInt(true));

input.readInt() is the number of animations in the data and it is -1. It appears the data is corrupt. If it works in the game, it could be the game customized parsing the binary skeleton data.

Thanks for your answer! I really want to view them on Spine, so I wonder if it is possible to edit this .skel file, to make it possible to open in Spine? or is there another way to open this .skel file? Hoping for your reply.

    eiur9823sl If you cannot open the file in the editor, you can try SkeletonViewer, but since it has been confirmed by Nate that even SkeletonViewer cannot open the data, unfortunately we do not have a solution to offer. The best thing to do is to contact the author of the skeleton data.

    I sad to hear that. I still hope someone meet the same problem may give me a solution, and thanks again for all your answer.

    The binary format is not very forgiving. You could edit the data, but what is the right value for the number of animations? -1 doesn't make sense, but the number needs to be correct for the data that follows. It's very unlikely to be able to repair the data, sorry!

    Sad to hear that. Anyway thanks a lot for your answer.

    11 days later

    I found the animation data ! BUT it is .fbx file, I opened it with Notepad and could see the animation data like idle in it but have no idea how to use it. I would like to know is there any way to combine this animation data with skelton data and open it? OR could I open it in Unity and how can I do that? Looking for your reply.

    Here is the file.

    hero-xinghe-pf2-opera.bin
    12kB

    It was .fbx in my computer but becomes a .bin when I sent it. But I have compared that the content does not change.
    And the atlas and texture are here, they are really pretty and I want to view on my computer.

    hero-xinghe-pf2atlas.txt
    14kB

    FBX is a format for 3D models, animation, and other data. It's not Spine data, so it can't be imported into Spine. I'm not sure how the game is storing its Spine animation, but it could be using a combination of Spine and FBX to animate and render different parts of the game.

    Thanksk for your answer. Would it be possible to import them into Unity engine to work together?

    I believe you can use FBX in Unity. There are many apps that support FBX.

    Thanks for your answer. I mean I want to import the skelton data, altas data, texture data and FBX data into unity engine, and make them work together to show the dynamic effects in the game. I have learned how to import ordinary Skelton assets into unity, but I can't find the corresponding import method for this action file that is a separate FBX file. Can you give me some advice?

    @eiur9823sl Please note that FBX is a very generic 3D format which can contain all kinds of data, like 3D meshes, animations, blend shapes, vertex animation, camera data, and so on. It is not related to Spine, and has not been exported from the Spine Editor.

    If the FBX file should contain a 3D model and some animations, you likely should have some textures as well which need to be applied to the 3D model. If they are not automatically displayed in the Inspector when selecting the FBX file in the Project panel, there might be something missing, or you need to create a Material and assign the textures manually. You might want to ask on the Unity forums if you are having troubles importing your FBX 3D model in Unity, or might want to check out the Unity documentation on 3D model import options:
    https://docs.unity3d.com/Manual/ImportingModelFiles.html

    4 days later