Why i am getting a NoClassDefFoundError:javax.imageio.ImageIO when trying to get an InputStream from assestManager

518 views Asked by At

I have a gfx folder inside assets folder of my Android project, which contains a .png file. When I was trying to get InputStream from assetManager, I got NoClassDefFoundError. The part where I got error is:

private void  processImage(){

    try {

        //This is where i got exception when i look from debugger..
        BufferedImage image = ImageIO.read(GameActivity.getActivity().getAssets().open("gfx/" + this.fileName));

        this.imageWidth = image.getWidth();
        this.imageHeight = image.getHeight();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }   
}

I looked for what a NoClassDefFoundError is, but I couldn't figure it out. What is causing it in my case?

0

There are 0 answers