Skip to content
Advertisement

Libgdx Keep getting an error when I try to load a Tiled Map

I am relatively new to libgdx and I cannot figure how to fix this error I keep getting. I have tried multiple sources but none seem to work and I feel like there might be an error in my code. The error is…

Execution failed for task ‘:desktop:DesktopLauncher.main()’.

Process ‘command ‘/Users/rehan_samaratunga/Library/Java/JavaVirtualMachines/corretto-17.0.2/Contents/Home/bin/java” finished with non-zero exit value 1

My code is…

public class testScreen implements Screen {
private final dungeonGame game;

// Asset Manager
private AssetManager manager;

// Map
private TiledMap map;
private TiledMapTileLayer terrainLayer;
private int[] decorationLayersIndices;

// Map Properties
private int tileWidth, tileHeight, mapWidthInTiles, mapHeightInTiles, mapWidthInPixels, mapHeightInPixels;


// Camera and Renderer
private OrthographicCamera camera;
private OrthogonalTiledMapRenderer renderer;

public testScreen(dungeonGame game) {
    this.game = game;
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 480);

    manager.setLoader(TiledMap.class, new TmxMapLoader());
    manager.load("onlyBoxes.tmx", TiledMap.class);
}

@Override
public void show() {
}

@Override
public void render(float delta) {

    ScreenUtils.clear(0.109f, 0.066f, 0.090f, 1);

    camera.update();
    game.batch.setProjectionMatrix(camera.combined);

    game.batch.begin();
    game.batch.end();
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}

Can anybody help?

Advertisement

Answer

Its all good I found how to fix it. I reinstalled Libgdx but a earlier version of it and the problem fixed. I know its not the best way to fix it but right now just for learning its all good.

Advertisement