1

I'm trying to include andengine physicsbox2d-extension in my project. It was very easy using eclipse (Just import the project and include in path)

But now I'm trying to do it in android studio

I tried those 2 method and get exception in both of them

Method 1: Include andenginephysicsbox2dextension.jar

this cause the following run time exception:

E/AndroidRuntime﹕ FATAL EXCEPTION: UpdateThread
java.lang.UnsatisfiedLinkError: Couldn't load andenginephysicsbox2dextension from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.myproject.myproject-2.apk,libraryPath=/data/app-lib/com.myproject.myproject-2]: 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)

Method 2 : Include andEnginePhysicsBox2DExtension project

this cause a compilation error:

    Error:Execution failed for task ':andEnginePhysicsBox2DExtension:compileReleaseNdk'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Program Files\Android\android-ndk-r10\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\MYUSER\AndroidstudioProjects\myproject\andEnginePhysicsBox2DExtension\build\intermediates\ndk\release\Android.mk APP_PLATFORM=android-14 NDK_OUT=C:\Users\MYUSER\AndroidstudioProjects\myproject\andEnginePhysicsBox2DExtension\build\intermediates\ndk\release\obj NDK_LIBS_OUT=C:\Users\MYUSER\AndroidstudioProjects\myproject\andEnginePhysicsBox2DExtension\build\intermediates\ndk\release\lib APP_ABI=all
Error Code:
    1 

Does anyone manage to import this extension to android studio?

What am I doing wrong?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Aviram Fireberger
  • 3,910
  • 5
  • 50
  • 69

2 Answers2

0

You can go on with Method 1:

  • include andenginephysicsbox2dextension.jar
  • create a folder named jniLibs inside your app project directory and copy armeabi, armeabi-v7a and x86 folders to it
ph0b
  • 14,353
  • 4
  • 43
  • 41
0

your project is ignoring .so files from the extension project.

you can follow my answer here https://stackoverflow.com/a/34068202/2026280

or

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.

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