loadLibrary("all_joyn_java") can't be loaded

asked 2015-02-04 10:16:22 -0700

JavierT gravatar image

updated 2015-02-04 10:17:00 -0700


I am trying to do my own app and I'm getting some problems to load the .so library. I'm using Android Studio 1.1 Preview 1, and I have a simple app that has two buttons, one for acting as a service and the other as the client (following the simple example). When I jump to the client activity, I make the call for the library

public class JoinActivity extends ActionBarActivity {
/* Load the native alljoyn_java library */
static {

It's quite similar to the Simple Client code, only difference is that I'm using fragments instead of activities. But the app crashes when it tries to get the library.

E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: drawing.training.javi.drawingapp, PID: 11070
java.lang.UnsatisfiedLinkError: Couldn't load all_joyn_java from loader dalvik.system.PathClassLoader[dexPath=/data/app/drawing.training.javi.drawingapp-16.apk,libraryPath=/data/app-lib/drawing.training.javi.drawingapp-16]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:358)
        at java.lang.System.loadLibrary(System.java:526)
        at drawing.training.javi.drawingapp.JoinActivity.<clinit>(JoinActivity.java:42)
        at java.lang.Class.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1208)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2464)
        at android.app.ActivityThread.access$900(ActivityThread.java:172)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5653)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
        at dalvik.system.NativeStart.main(Native Method)

However, when I import the simple client code in Android Studio (using the option import a non Android Studio project), it works. It finds the library. The same with all the other examples.

Here I put a screenshot of my folder structure and the gradle (due to my karma is under 10 and I can't upload a pic here...) http://dl.dropbox.com/u/1475818/Selection_001.png --src |-- main |-- java |--jniLibs: |--|--armeabi: |--|--|--liballjoyn_java.so.

I took the .so from the Alljoyn/alljoyn-android/core/alljoyn-14.12.00a-rel/java/lib folder There is some code commented in the gradle (i was trying different solutions I saw in stackoverflow but all of them are for previous versions of Android Studio, and it looks now it should be possible to make it work without all of these configurations http://ph0b.com/android-studio-gradle-and-ndk-integration/ )

Thank you in advance.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2015-02-04 10:43:03 -0700

ry.jones gravatar image
Linux Foundation Staff

You should import alljoyn_java, not all_joyn_java.

edit flag offensive delete publish link more

answered 2015-02-04 10:49:41 -0700

JavierT gravatar image

hahaha, you have to be kidding me... 1 hour looking in forums for ndk imports and so on, and I didn't realize this.. I think I need a break, hahaha.

Thank you very much. You can even delete the post. Sometimes is better to go to sleep than keep hitting your head agains the wall, hahaha

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-04 10:16:22 -0700

Seen: 1,028 times

Last updated: Feb 04 '15