2

I'm trying to work with andengine in "Android studio, not eclipse" and im getting this error when i run the project.

9442-29483/com.makeinfo.andenginetemplate E/AndEngine﹕ MainActivity.onCreateScene failed. @(Thread: 'GLThread 2726')
java.lang.UnsatisfiedLinkError: Couldn't load andenginephysicsbox2dextension from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.makeinfo.andenginetemplate-1.apk,libraryPath=/data/app-lib/com.makeinfo.andenginetemplate-1]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:355)
        at java.lang.System.loadLibrary(System.java:525)
        at org.andengine.extension.physics.box2d.PhysicsWorld.<clinit>(PhysicsWorld.java:35)
        at com.makeinfo.andenginetemplate.MainActivity.onCreateScene(MainActivity.java:71)
        at org.andengine.ui.activity.BaseGameActivity$3.onCreateResourcesFinished(BaseGameActivity.java:169)
        at com.makeinfo.andenginetemplate.MainActivity.onCreateResources(MainActivity.java:55)
        at org.andengine.ui.activity.BaseGameActivity.onCreateGame(BaseGameActivity.java:181)
        at org.andengine.ui.activity.BaseGameActivity.onSurfaceCreated(BaseGameActivity.java:110)
        at org.andengine.opengl.view.EngineRenderer.onSurfaceCreated(EngineRenderer.java:80)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1509)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

In some answers, someone said verify your build path settings but i didn't get what he exactly meant. I copied and pasted the library folders (which got "libandenginephysicsbox2dextension.so" inside of them) into my main projects lib folder. What should i do to fix this problem. Any help or suggestions will be appreciated!

Here is the project folder setup:

enter image description here

SOLVED: http://geq-i.blogspot.com/2014/02/how-to-setup-andengine-in-android-studio.html

is referring to andengine is referring to andenginebox2dextension

Tolga Şen
  • 289
  • 5
  • 14

2 Answers2

6

Its very simple. Follow this simple steps

1) Create a new folder called "lib" inside the libs folder of the main app.

2) Copy all the folders ie.armabi , armabi-v7a etc from andEnginePhysicsBox2DExtension/libs folder, and paste in in the previously created "lib" folder in main app.

3) Now compress the "lib" folder as "lib.zip" and rename it to "lib.jar". this changes the zip extension to jar.

4) Finally add a line -- compile files('lib.jar') under dependencies{} in Build.gradle file of your main app.

5) Clean and build the project.

Sandeep R
  • 2,284
  • 3
  • 25
  • 51
1

Place your jni precompiled libraries (.so files) as per the following structure

app->src->jniLibs

    ->armeabi->your_libs.so

    ->armeabi-v7a->your_libs.so

    ->x86 ->your_libs.so
  • Where app is your main app
  • and jniLibs is the default folder which is picked up automatically (keep this exact folder name)
Vinay W
  • 9,912
  • 8
  • 41
  • 47
  • I did the steps you suggested exactly as they are but it still gives same error. Is there a chance that this problem has relation with build.gradle files? I have every module in my project, but it cannot load the library?? – Tolga Şen Jun 24 '15 at 14:43
  • changing the folder name from "libs" to "jniLibs" did the trick :)! thanks! – sjkm Jan 22 '16 at 01:23