0

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 :)

Abhishek Aryan
  • 19,936
  • 8
  • 46
  • 65
smolus
  • 115
  • 12

1 Answers1

2

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" /> 
Abhishek Aryan
  • 19,936
  • 8
  • 46
  • 65
  • 1
    Thank you so much for your help, it took me a while to understand how to use theese reflections in my code but it finaly worked. Hope you'll have a nice day :) – smolus Jun 23 '17 at 15:35
  • I have more or less the same problem and add extend configuration property didn't help me. There is something else to do?? – Benjamin Lucidarme Jun 12 '18 at 12:41
  • @BenjaminLucidarme Can you show me your error log, It'll be great if you create one new topic for your problem, you can reference this thread in your question. I'll try to help you there. – Abhishek Aryan Jun 12 '18 at 12:45
  • Here is my question (https://stackoverflow.com/questions/50817992/export-libgdx-project-to-html-did-you-forget-to-inherit-a-required-module) – Benjamin Lucidarme Jun 12 '18 at 13:06