Top and bottom parts of window/viewport missing on Android export

Godot Version 4.2


The project is 1080 width and 1960 height.
The window when running the project from Godot is fine. But when exporting to Android, there is a black border at the top and bottom.
The aspect ratio seems to have changed…

I can move the player sprite into the black areas, which should not be possible since it’s position is clamped to within the game area. This also only happens on the Android built apk, not when running the game from Godot.

Is there some stretch mode which needs to be considered? Can you detect the screen size somehow?

when you try to put your nodes, put it in a Control Node, and set the control Node to be Full Rect
so it always detect changes and fit the current screen resolution

else you also can try to set your game in project settings like this: