androidandroid-ndkmetaiocode-generation

java.lang.UnsatisfiedLinkError: Couldn't load echoprint-jni from loader dalvik.system.PathClassLoader


I am using Echoprint in my android project as explained here and it works ok. However, when I try to add the metaioSDK library to the project (just add it, not even use it), I can't run Echoprint anymore. I get:

07-17 14:20:34.194: E/AndroidRuntime(3681):     FATAL EXCEPTION: Thread-92046    
07-17 14:20:34.194: E/AndroidRuntime(3681):     java.lang.UnsatisfiedLinkError: Couldn't load echoprint-jni from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.example.kkt-1.apk,libraryPath=/data/app-lib/com.example.kkt-1]: findLibrary returned null    
07-17 14:20:34.194: E/AndroidRuntime(3681):     at java.lang.Runtime.loadLibrary(Runtime.java:355)    
07-17 14:20:34.194: E/AndroidRuntime(3681):     at java.lang.System.loadLibrary(System.java:525)    
07-17 14:20:34.194: E/AndroidRuntime(3681):     at edu.gvsu.masl.echoprint.Codegen.<clinit>(Codegen.java:44)    
07-17 14:20:34.194: E/AndroidRuntime(3681):     at edu.gvsu.masl.echoprint.AudioFingerprinter.run(AudioFingerprinter.java:199)    
07-17 14:20:34.194: E/AndroidRuntime(3681):     at java.lang.Thread.run(Thread.java:841)

The file libechoprint-jni.so is in the "/libs/armeabi/" folder and I call it System.loadLibrary("echoprint-jni"), which worked before adding the metaio library. How come it doesn't work after? Ask if any other details are needed/printscreens/etc.

EDIT:

I've noticed that EchoprintLibrary has libechoprint-jni.so in: /libs/armeabi/

metaioSDK has about 7 .so files in: /libs/armeabi-v7a/

On my phone, when the app only uses Echoprint, I can find the libechoprint-jni.so in

/data/data/com.example/kkt/lib/
/data/app-lib/com.example.kkt-2/

When I also add metaioSDK to the mix, libechoprint-jni.so is nowhere to be found, but all the metaio .so files can be found in

/data/data/com.example/kkt/lib/
/data/app-lib/com.example.kkt-1/

So I guess in the end, it may be a question of how to have .so libraries from multiple sources..


Solution

  • I've managed to make it work by moving the Echoprint source files inside my own project and moving the libechoprint-jni.so in the metaio libs/armeabi-v7a folder, next to the other .so files. Basically all the .so files had to be grouped under one folder/project. Might not work for everyone, but it worked for me.