The problem is that you're trying to load PolygonShapes
before the native library for Box2D has been loaded. As explained here, the Box2D native libraries are loaded in a static initializer of the World
class.
I'm not sure if this is intended behavior, but it seems like an edge case that was missed when refactoring the Box2D code into an extension.
You can work around this either by creating a World
, or by loading the Box2D native library, before loading your polygons/bodies/whatever.
I'm not exactly sure how to load native libraries, but a simple new World(args)
should do just fine.