Android Emulators aren't returning the correct stage size

My game reads stage.stageWidth at startup to configure itself. This works as expected on devices but the emulator returns a large (sometimes negative) value such as 344670208 for stage.stageWidth as well as openfl.system.Capabilities.screenResolutionX.

Is there a fix for this, or another way to read the screen size?

My configuration:

  • haxe 4.2.5
  • lime 8.0.0
  • openfl 9.2.0

The emulators show the same problem on the Nexus 10 and Pixel C emulators targeting SDK 22 and SDK 33. I’m on a Mac.