我试着通过这种方式加载lib:
getBundledStackLibFile():
PackageInfo packageInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
if(packageInfo != null) {
ApplicationInfo appInfo = packageInfo.applicationInfo;
File f = getLibFileFromPackage(appInfo, libName, true);
return f;
}
// This is the very last fallback method
return new File(ctx.getFilesDir().getParent(), "lib" + File.separator + libName);
然后我使用绝对路径来使用.so文件:
File openslLib = getBundledStackLibFile(activityForUsing,
"libpj_opensl_dev.so");
audImp.setShared_lib_path(pjsua.pj_str_copy(openslLib.getAbsolutePath()));
但我有错误:
10-01 10:53:11.209:无法打开:/data/data/com.myApp.android/lib/libpj_opensl_dev.so无法加载库:link_image [1995]:无法链接libpj_opensl_dev.so
这是解压缩的ark文件(所有目录中都有必要的lib,屏幕简称只是示例。