Android 如何查找so文件所在目录,安装APK时so安装到哪个目录
来源:互联网 发布:linux切换到图形界面 编辑:程序博客网 时间:2024/05/16 17:47
Android 如何查找so文件所在的目录:OS<=2.2 和 OS>=2.3 的方法有所区别,见下面代码
/** * The function use to find so path for compatible android system * Android OS >= 2.3 */ public static String findLibrary1(Context context, String libName) { String result = null; ClassLoader classLoader = (context.getClassLoader()); if (classLoader != null) { try { Method findLibraryMethod = classLoader.getClass().getMethod("findLibrary", new Class<?>[] { String.class }); if (findLibraryMethod != null) { Object objPath = findLibraryMethod.invoke(classLoader, new Object[] { libName }); if (objPath != null && objPath instanceof String) { result = (String) objPath; } } } catch (NoSuchMethodException e) { Log.e("findLibrary1", e.toString()); } catch (IllegalAccessException e) { Log.e("findLibrary1", e.toString()); } catch (IllegalArgumentException e) { Log.e("findLibrary1", e.toString()); } catch (InvocationTargetException e) { Log.e("findLibrary1", e.toString()); } catch (Exception e) { Log.e("findLibrary1", e.toString()); } } return result; } /** * The function use to find so path for compatible android system * Android OS <= 2.2 */ public static String findLibrary2(Context context, String libName) { String result = null; ClassLoader classLoader = (context.getClassLoader()); if (classLoader != null) { try { Method findLibraryMethod = classLoader.getClass().getDeclaredMethod("findLibrary", new Class<?>[] { String.class }); if (findLibraryMethod != null) { if (!findLibraryMethod.isAccessible()) { findLibraryMethod.setAccessible(true); } Object objPath = findLibraryMethod.invoke(classLoader, new Object[] { libName }); if (objPath != null && objPath instanceof String) { result = (String) objPath; } } } catch (NoSuchMethodException e) { Log.e("findLibrary2", e.toString()); } catch (IllegalAccessException e) { Log.e("findLibrary2", e.toString()); } catch (IllegalArgumentException e) { Log.e("findLibrary2", e.toString()); } catch (InvocationTargetException e) { Log.e("findLibrary2", e.toString()); } catch (Exception e) { Log.e("findLibrary2", e.toString()); } } return result; }
0 0
- Android 如何查找so文件所在目录,安装APK时so安装到哪个目录
- apk和so库的安装目录
- Ubuntu如何查找libz.so.1属于哪个包并安装
- Ubuntu如何查找libz.so.1属于哪个包并安装
- Ubuntu如何查找某个*.so属于哪个包并安装
- Ubuntu如何查找libz.so.1属于哪个包并安装
- android 安装apk 到 /system/app 目录
- android打包so文件到apk
- android打包so文件到apk
- android打包so文件到apk
- Android打包so文件到apk
- android打包so文件到apk
- android打包so文件到apk
- android打包so文件到apk
- android打包so文件到apk
- Android JNI打包so文件到apk
- Android JNI打包so文件到apk .
- Ubuntu15.04如何查找libz.so.1属于哪个包并安装
- 浅谈java中 hashCode方法
- React State 状态机
- 写一个简单的短信监听器——SmsListener
- 求两个数的最大公约数(欧几里德算法)
- 使光标指定到EditText中
- Android 如何查找so文件所在目录,安装APK时so安装到哪个目录
- 使用StartSSL为网站添加SSL
- hook 鼠标键盘消息实例分析
- sqlite Manager的使用和在mac ox上创建DB数据库快捷方式
- js时钟
- Java的位运算符详解实例——与(&)、非(~)、或(|)、异或(^)
- sublime3+quick3.5 完整使用教程
- poj2082 连续矩形最大面积
- 继承关系类实例对象的非绑定关系方法调用