(LibGdx) Scalling for multiple Android devices

I’m trying to scale my app for multiple devices. So here is what I use to render things on the screen. Sadly, it only fits a certain phone.

INIT()/CREATE()

camera = new OrthographicCamera();
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
ps = new Sprite(new Texture(Gdx.files.internal("playerZ")));
ps.setPosition(camera.viewportWidth/2, 100);

RENDER()

Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
update(1/60f);
camera.update();
batch.setProjectionMatrix(camera.combined);

batch.begin();
ps.draw(batch);
batch.end();

This draw the image fine, but (using the emulator and my phone) this doesn’t look the same on different resolutions.

Have a look at this -> https://github.com/libgdx/libgdx/wiki/Viewports
Viewports is teh key, have fun :wink:

I have exactly the same problem…

I am currently using StretchViewport because the screen height and width is really important in my game and I don’t know what is best way to deal with this… I tried all libGDX viewports but none can solve the resolution problem… I think the only way is using FitViewport but I don’t like black bars or creating a different layout for low resolutions and try keep with the correct aspect ratio.