Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving java.lang.UnsatisfiedLinkError on badlogic.BufferUtils

Tags:

java

libgdx

When lunching the application with DesktopLuncher i experience UnsatisfiedLinkError on root class (Main) in core module inside the project.

public class Main extends Game {

    @Override
    public void create() {
        this.cameraBuilder = ...
        setScreen(new LandingMenu(this));
    }
    
    @Override
    public void render() {
        super.render();
    }
    
    @Override
    public void dispose() {
        batch.dispose();
    }
    
    public World getWorld() {
        return world;
    }
    
    public SpriteBatch getBatch() {
        return batch;
    }
    
    public CameraBuilder<OrthographicCamera> getCameraBuilder() {
        return cameraBuilder;
    }
    
    private final SpriteBatch batch = new SpriteBatch();;
    
    private CameraBuilder<OrthographicCamera> cameraBuilder;
    
    private final World world = new World(new Vector2(0, -9.8f), true);
}

any answer will be appreciated.

like image 924
Beharat Avatar asked Dec 02 '25 22:12

Beharat


1 Answers

The exception is a cause and issue lives on create method on ApplicationListener Called when the Application is first created, on the other hand SpriteBatch is a Batch which is used for drawing Sprites, more specifically, it deals with drawing a bunch of textures on Quads in OpenGL thus is must be initialized inside of create method and not in the root class level.

    @Override
    public void create() {
        batch = new SpriteBatch();
        setScreen(new LandingMenu(this));
    }
    
    ...
    
    private SpriteBatch batch;

Find more in here.

like image 195
Lunatic Avatar answered Dec 04 '25 12:12

Lunatic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!