• Advertisement
Sign in to follow this  

libGDX weird SpriteBatch error

This topic is 1360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Edited by lavalamp360

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement