It's funny I'm finding all my answers lately... anyway, since it can be useful to others out there, if you want to:
- add the path of a shared library like
liblame.so
- loaded with
System.loadLibrary("lame")
fromlibs
folder - and you want to use
ProcessBuilder
do:
1)
ProcessBuilder pb = new ProcessBuilder("liblame.so");
Map<String, String> envMap = pb.environment();
envMap.put("LD_LIBRARY_PATH", "/data/app-lib/<<my-pkg-name>>/");
or, better, to avoid handling the "-1" or "-2" suffix after the package name (that changes):
2)
ProcessBuilder pb = new ProcessBuilder();
Map<String, String> envMap = pb.environment();
envMap.put("LD_LIBRARY_PATH", "/data/data/<<my-pkg-name>>/lib");
and to not hard-code /data/data/<<my-pkg-name>>/lib
use: Context.getApplicationInfo().nativeLibraryDir
With this solution 2) I found also that System.loadLibrary("lame")
it's not needed.