question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClassCastException in Animation.getKeyFrames()

See original GitHub issue

Issue details

Affected calss com.badlogic.gdx.graphics.g2d.Animation

code: Animation<TextureRegion> animation = new Animation<TextureRegion>(...); TextureRegion[] f = animation.getKeyFrames(); cause: Exception in thread “LWJGL Application” java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.badlogic.gdx.graphics.g2d.TextureRegion;

this code: Object[] f = animation.getKeyFrames(); does not throw exceptions

Version of LibGDX and/or relevant dependencies

LibGDX v1.9.5

Please select the affected platforms

  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
JuKucommented, Sep 15, 2017

I get the same exception with libGDX 19.6 .

0reactions
Darkyenuscommented, Nov 2, 2019

@samboadas221 This has already been fixed. Read the javadoc of the constructors carefully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - ClassCastException in Animation.getKeyFrames() -
Issue details. Affected calss com.badlogic.gdx.graphics.g2d.Animation. code: Animation<TextureRegion> animation = new Animation<TextureRegion>(...);
Read more >
Strange java.lang.ClassCastException when using [] call
If i change it to get() error disappears. tex = animation.keyFrames.get(0). Here is full method. I simplified example.
Read more >
Strange java.lang.ClassCastException when using [] call-kotlin
This is interesting! Decompiling val tex1 = animation.keyFrames.get(0). gives. ALOAD 2 INVOKEVIRTUAL com/badlogic/gdx/graphics/g2d/Animation.getKeyFrames ...
Read more >
javafx.animation.Timeline.getKeyFrames java code examples
public static void hackTooltipStartTiming(Tooltip tooltip) { try { Field fieldBehavior = tooltip.getClass().getDeclaredField("BEHAVIOR"); fieldBehavior.
Read more >
core/java/android/animation/PropertyValuesHolder.java - platform ...
derived when the animation starts in setupSetterAndGetter() if using ObjectAnimator. ... setupValue(target, keyframes.get(keyframes.size() - 1));. }.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found