libGDX weird SpriteBatch error

Started by
1 comment, last by lavalamp360 9 years, 11 months ago

I started using libGDX recently and started making a Pong clone to start with it (its how i get used to/learn new frameworks).

Every time I try to create a SpriteBatch object like so:


SpriteBatch batch = new SpriteBatch();

I get this bizzare compiler error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(I)Ljava/nio/ByteBuffer;

at com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(Native Method)

at com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(BufferUtils.java:517)

at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:59)

at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:50)

at com.badlogic.gdx.graphics.Mesh.<init>(Mesh.java:145)

at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:93)

at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:72)

at com.********.**********.GameMaster.<init>(GameMaster.java:18)

at com.********.**********.Main.main(Main.java:18)

I cant seem to figure out what the issue is. I've included all necessary .jar files to the build path too.

Advertisement

I started using libGDX recently and started making a Pong clone to start with it (its how i get used to/learn new frameworks).

Every time I try to create a SpriteBatch object like so:


SpriteBatch batch = new SpriteBatch();

I get this bizzare compiler error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(I)Ljava/nio/ByteBuffer;

at com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(Native Method)

at com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(BufferUtils.java:517)

at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:59)

at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:50)

at com.badlogic.gdx.graphics.Mesh.<init>(Mesh.java:145)

at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:93)

at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:72)

at com.********.**********.GameMaster.<init>(GameMaster.java:18)

at com.********.**********.Main.main(Main.java:18)

I cant seem to figure out what the issue is. I've included all necessary .jar files to the build path too.

You are missing a dependency. Did you create your project using the setupUI?

Nevermind. I figured it out. Just in case anyone else experiences the same problem, you apparently cannot initialize libGDX objects in this way. You must initialize them in the create() method which is basically a replacement for the constructor.

This topic is closed to new replies.

Advertisement