I want to get the native lib path from data for my app that will be installed in the system, I have tried this code:
String libPath = "/data/data/" + packageName + "/lib/" + libName+".so";
System.load(libPath);
But it gives this error:
java.lang.UnsatisfiedLinkError: dlopen failed: library /data/data/xxxx/lib/lib.so not found
I tried to not hardcod it using
String libraryPath = context.getFilesDir().getParentFile().getPath() + "/lib/"+libname+".so";
System.load(libraryPath);
but the same error was shown, if I use this code :
String libPath = context.getApplicationInfo().nativeLibraryDir +libname+".so";
System.load(libPath);
The app will try to get native lib from system/app and the same error is shown, Can anybody help to force get native lib from data? Maybe something like this
context.getApplicationInfo().nativeLibraryDir
But force to data, not system, because when I try to show that libpath in log (when I try installed in data), it will show
/data/app/apppackage-1/lib/arm/libname.so
There is a number after package name sometimes -1, sometimes -2.