java.lang.NoClassDefFoundError for GIF image

I am playing a GIF image in the main window, just for testing the GifAnimation Library.

I used the following code as prescribed by the library…

import gifAnimation.*;

Gif myAnimation;

void setup() {
   myAnimation = new Gif(this, "goose_anim.gif");;

void draw() {
   image(myAnimation, 10, 10);

I get the following error…

FATAL EXCEPTION: Animation Thread
Process: processing.test.testgif, PID: 11663
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/image/BufferedImage;
at gifAnimation.GifDecoder.readImage(Unknown Source:131)
at gifAnimation.GifDecoder.readContents(Unknown Source:21)
at Source:28)
at gifAnimation.Gif.createDecoder(Unknown Source:9)
at gifAnimation.Gif.<init>(Unknown Source:14)
at processing.test.testgif.testGIF.setup(
at processing.core.PApplet.handleDraw(
at processing.core.PSurfaceNone.callDraw(
at processing.core.PSurfaceNone$
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.image.BufferedImage" on path: 
DexPathList[[zip file "/data/app/processing.test.testgif-Q3STI5jY7Vf5yp95- 
     ngzCA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
... 9 more

Did anyone else encounter this yet?
I am new to the library, so have never seen this…

Looks like you’re on Android from the stack trace? Don’t think BufferedImage exists on Android so don’t think that library can work as is.

1 Like

The sketch functions in Java mode, so thank you for your add.

Does this mean that the GifAnimation Library can only be used in Java mode and not in Android mode?

Can I avoid having to export it to Android Studio and then adding GIF ImageView to it?

Yes. It would need to be rewritten to only use classes available in both the full JDK and Android, or use specific functionality on each platform. Android is not a full Java implementation.

ok, this is of great help to me!
saves me a lot of time…

Thanks man!