Adding jBox2D to Android Studio project

410 Views Asked by At

I would like to add jBox2D to my Android game, and I've included the .jar file in the Project Structure/Dependencies, but my app keeps crashing at the World object creation.

The error message is

java.lang.NoClassDefFoundError.

Is there something I'm doing wrong?

1

There are 1 best solutions below

1
a n On

If you are not using Maven, just paste .jar file in the project directory. And include following line in the dependencies section of Gradle build:

compile files('jbox2d-library-[version].jar')

If you are using Maven refer Jbox2d getting starter guide