• 中文
  • libgdx java.lang.ArrayIndexOutOfBoundsException

  • Изменено
Related Discussions
...

java.lang.ArrayIndexOutOfBoundsException: length=16; index=16
at com.esotericsoftware.spine.AnimationState.apply(AnimationState.java:251)
这个问题概率性出现 libgdx android java


这里是详情图片


这里出错。MixBlend timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
因为timelineCount和timelineMode.size不匹配导致ArrayIndexOutOfBoundsException异常

Does the skeleton data you are loading match the version of the Spine Runtimes you are using? See:
你正在加载的骨架数据是否与你所使用的Spine Runtimes的版本相符?见。
Versioning - Spine User Guide: Synchronizing versions

If so, can you please post the skeleton data so we can see the error?
如果是的话,你能不能把骨架数据贴出来,以便我们能看到错误?

5 дней спустя

spine是4.0.64 runtime libgdx是4.0.18.1


好像就是这个动作会出现 “guang”
每次都是timelineMode这个对象长度只有16个,但是current.animation.timelines.size这个却是31个
还有就是你说的骨骼数据是skeleton里面的bones吗?

Can you please post the skeleton data so we can see the error?
你能不能把骨架数据贴出来,让我们看看这个错误?

因为我不知道你要的骨架数据是哪一个,我就只好把源文件和工程文件你看下
骨架我导成了json格式的,方便观看

Thanks. I'm able to load and render the data in the 4.0 runtimes. The guang animation plays and I'm unable to see an error occur.

I understand you only see the error sometimes on Android? Do you call AnimationState methods from multiple threads? You must be careful to only call the methods from the OpenGL thread. This is very likely the reason you see the problem.

When you set a new animation on AnimationState, it calls its private animationsChanged method which resizes timelineMode. If you do that on a different thread at the same time the OpenGL thread is looping over the timelineMode, it will cause this crash.


谢谢。我能够在4.0的运行时间内加载和渲染数据。guang动画播放,我无法看到错误发生。

我知道你只是在Android上有时看到错误?你是否从多个线程调用AnimationState方法?你必须注意只从OpenGL线程调用这些方法。这很可能是你看到这个问题的原因。

当你在AnimationState上设置一个新的动画时,它会调用其私有的animationsChanged方法来调整timelineMode的大小。如果你在OpenGL线程循环处理`timelineMode'的同时,在不同的线程上做这个动作,就会导致这个崩溃。