简体   繁体   中英

Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject'

Ok, so I made a simple game in libgdx (Android Studio). It works on desktop as well as on Android but in html throws this error :

Uncaught Error: java.lang.RuntimeException: java.lang.RuntimeException: Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject'

The only code that uses RectangleMapObject in my code is this:

for(MapObject mapObject: tiledMap.getLayers().get(1).getObjects().getByType(RectangleMapObject.class)){
        Rectangle rectangle = ((RectangleMapObject)mapObject).getRectangle();
        createGround(rectangle.getX()/ 70f, rectangle.getY() / 70f, rectangle.getWidth() / 70f, rectangle.getHeight()/70f);
}

I spent almost two days trying to make it work and found nothing. If someone knows the solution to this problem, Its cause or anything like that i would realy appriciate some help :)

Reflection on gwt requires some massaging to work

https://github.com/libgdx/libgdx/wiki/Reflection#gwt


Add this to your GdxDefinition.gwt.xml :

<extend-configuration-property name="gdx.reflect.include" value="com.badlogic.gdx.maps.objects.RectangleMapObject" /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM