Search code examples
javajsonlibgdxbox2dgame-physics

Box2D & LibGDX: BodyEditorLoader error


I use the lastest version of LibGDX: 0.9.9! After have created a JSON file by Physics Body Editor 2.9.2, I try to load it in my game. So i wrote this in my code:

        BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/myproject.json"));

But, when i run the game i obtain this error:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.badlogic.gdx.utils.JsonReader.parse(Ljava/lang/String;)Ljava/lang/Object;

Searching in the web i have deduced that there is a difference between the JSON API of LibGDX (that was changed) and the Physics Body Editor JSON file generator, that is difference than the one.

Can someone help me? Thanks!


Solution

  • I have solved the problem. Just use a fixed file BodyEditorLoader.java than the original file available in the framework. (The file included in the framework is refered to a version of Physics Body Editor that has a different JSON API than the last LibGDX).

    You can download the fixed BodyEditorLoader.java here!.