Are there any decent physics engines for Android?-ThrowExceptions

Exception or error:

I’ve looked around for a physics engine that will play nicely with Android, but I’ve only been disappointed.

In terms of performance, I had heard that jbox2d was the best bet, but (from my understanding) ever since Android SDK V1.0, the Dalvik VM’s verifier has become very strict and rejects some of the key classes and refuses to run. This problem persists after using the dx tool (although I might be using the tool improperly).

I know that the AndroidBox2D porting project exists to optimize jbox2d for the Android garbage collector, but the project page doesn’t have any downloads and the gpl license isn’t as attractive as the zlib license of the original.

Does anyone have any tips for making jbox2d work in Eclipse, or have any recommendations for where I should start looking?

How to solve:

I don’t know why Dalvik would reject classes unless they were obfuscated with some tool. Did you try recompiling Box2d from source?

The only other Java lib I’ve seen is


I am getting good results with the Java version of APE using Fixed Point math rather than floats.


I have done an implementation of the APE engine now using (mostly) fixed point math and it is without garbage collection. Its a pretty nice engine to do stuff with constraints but seems less suited for really rigid bodies.

You could also look into the NDK port of Chipmunk (download link on youtube page)


Also look @ Glaze which is optimized for arrays .. might not be a horrible port to Java from AS3 (it was ported to Haxe also)


I am not sure, if jBox2D is really suitable for smartphones. I would rather look at J2ME engines, as they are highly optimized for performance- E.g:

Also you should have no problems with integration.


Libgdx has JBox2D built in and is cross platform (Android, Java Desktop, GWT Web) like Unity, tho it’s free and open source.

I got it set up in 15 minutes and was creating physics bodies in no time. The Libgdx physics manual helps from there. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *