Two issues with testing LibGDX on Android

| | August 11, 2015

1) When I test my game on desktop it is 100% fine. When I test it on my Nexus 7 physical device, it is the same except the backgrounds have no color. For example my splash screen has a greenish background, On desktop this is visible, on android it’s just a white background.

Splash screen:

public void render(float delta) {
    manager.update(delta);, 0, 0, 1);;
    backgroud.setColor(147, 112, 219, .4f);
    backgroud.filledRect(0, 0,,





2) When running my game on an Android emulator, it just shows up as a blank black screen on so far 5+ different emulators. What does this usually mean? No errors anywhere.

I also have cfg.useGL20=true;

One Response to “Two issues with testing LibGDX on Android”

  1. Have you tried a newer version of LibGDX? Support for GL 1 was removed a while ago so it seems that you’re using an old version. It might fix the problem. If that doesn’t work, can you show the rest of your code?

    Edit: Oh, and maybe change GL10.GL_COLOR_BUFFER_BIT to GL20.GL_COLOR_BUFFER_BIT

    Edit2: Okay, I noticed a few other things you can try. First, I think that the buffer bit part has to go before glClearColor(), not after. Second, when setting the color of backgroud you might try it with an alpha value of 1.0 and not 0.4, not sure why you would want to do that since you clear the screen beforehand so it won’t be see through anyway.

    Edit3: Last thing: you forgot to set the camera of the batch(es) it seems. Create a class variable “private OrthographicCamera camera;” in your class, and in the create function initialize it with “camera = new OrthographicCamera()”. Paste this line afterwards: “camera.setToOrtho(false,,;”. What this does is it initializes a camera and sets the bottom left of the screen to (0,0). Now you just have to initialize the batch before calling batch.begin(). Paste this before batch.begin(): “batch.setProjectionMatrix(camera.combined);” Take a look in the docs at the pages about cameras and spritebatches for more information. Also, I think you also have to do this for the backgroud variable, but you can probably figure that out yourself ;-)

Leave a Reply