I am developing a Video Player in Android. Because I need to use code with LGPL license, I have to put the native library in some place.
To load the jniLibs, I'm trying to use System.load()
.
With jniLibs folder within the project structure everything works fine, but in a different location the program ends with the error below.
did the following:
Manifest:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
MainActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
final String libPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/jniLibs/armeabi-v7a/libvlcjni.so";
final String libPath1 =Environment.getExternalStorageDirectory().getAbsolutePath()+ "/jniLibs/armeabi-v7a/libiomx-ics.so";
Log.d("path",System.getProperty("java.library.path"));
Log.d("path",libPath);
try{
System.load(libPath);
System.load(libPath1);
}catch (Exception ex){
ex.printStackTrace();
System.out.println("\n" + ex.getMessage());
System.out.println("\n" + ex.toString());
System.out.println("\nTrace info obtained from getStackTrace");
StackTraceElement[] traceElements = ex.getStackTrace();
for(int i=0 ; i<traceElements.length ; i++){
System.out.println("Method" + traceElements[i].getMethodName());
System.out.println("(" + traceElements[i].getClassName() + ":");
System.out.println(traceElements[i].getLineNumber() + ")");
}
}
I get this error:
01-25 19:05:24.292 340-340/com.compdigitec.libvlcandroidsample D/dalvikvm﹕ Trying to load lib /storage/emulated/0/jniLibs/armeabi-v7a/libvlcjni.so 0x41bd4bf0
01-25 19:05:24.369 340-340/com.compdigitec.libvlcandroidsample D/dalvikvm﹕ Added shared lib /storage/emulated/0/jniLibs/armeabi-v7a/libvlcjni.so 0x41bd4bf0
01-25 19:05:24.370 340-340/com.compdigitec.libvlcandroidsample D/VLC/JNI/main﹕ JNI interface loaded.
01-25 19:05:24.370 340-340/com.compdigitec.libvlcandroidsample D/dalvikvm﹕ Trying to load lib /storage/emulated/0/jniLibs/armeabi-v7a/libiomx-ics.so 0x41bd4bf0
01-25 19:05:24.373 340-340/com.compdigitec.libvlcandroidsample D/dalvikvm﹕ Added shared lib /storage/emulated/0/jniLibs/armeabi-v7a/libiomx-ics.so 0x41bd4bf0
01-25 19:05:24.373 340-340/com.compdigitec.libvlcandroidsample D/dalvikvm﹕ No JNI_OnLoad found in /storage/emulated/0/jniLibs/armeabi-v7a/libiomx-ics.so 0x41bd4bf0, skipping init
01-25 19:05:24.375 340-340/com.compdigitec.libvlcandroidsample E/VLC/LibVLC﹕ Can't load vlcjni library: java.lang.UnsatisfiedLinkError: Couldn't load vlcjni from loader
I've researched a lot on google and I still do not know how to solve it.