测试平台
Platform: RK3399/RK3328
OS: Android10.0
说明
rk提供了几种预置apk的方案给到客户,具体的集成方案可见源码下文档(RKDocs/android/Rockchip_Introduction_Android_Application_Preinstallation_CN&EN.pdf)
测试发现预置其他apk正常,但是预置kodi打开提示找不到so库
分析
查看源码可知,rk的preinstall是在frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java中做了处理
private static void setNativeLibraryPaths(PackageParser.Package pkg, File appLib32InstallDir, int scanFlags) {
...
} else {
// Cluster install
if ((scanFlags & SCAN_AS_PREBUNDLED_DIR) != 0
|| (scanFlags & SCAN_AS_PREINSTALL) != 0) {
// mAppLib32InstallDir is the directory /data/app-lib which is used to store native
// libs for apps from the system paritition. It isn't really specific to 32bit info
// any way except for the variable name, the system will use the primary/secondary
// ABI computed below.
info.primaryCpuAbi = "armeabi-v7a";
info.nativeLibraryRootDir = new File(codeFile, LIB_DIR_NAME).getAbsolutePath();
Log.d(TAG, info.primaryCpuAbi + " prebundled install " + info.nativeLibraryRootDir);
} else {
info.nativeLibraryRootDir = new File(codeFile, LIB_DIR_NAME).getAbsolutePath();
}
info.nativeLibraryRootRequiresIsa = true;
info.nativeLibraryDir = new File(info.nativeLibraryRootDir,
getPrimaryInstructionSet(info)).getAbsolutePath();
if (info.secondaryCpuAbi != null) {
info.secondaryNativeLibraryDir = new File(info.nativeLibraryRootDir,
VMRuntime.getInstructionSet(info.secondaryCpuAbi)).getAbsolutePath();
}
}
他在这里指定了info.primaryCpuAbi = “armeabi-v7a”;
强制使用armv7的so库,但是kodi-arm64中只有arm64位的库无32位的.所以修改这里让其可以适配64位和32位即可,修改补丁如下:
-info.primaryCpuAbi = "armeabi-v7a";
+info.primaryCpuAbi = "arm64-v8a";
+info.secondaryCpuAbi = "armeabi-v7a";
编译后测试OK。
测试平台
Platform: RK3399/RK3328
OS: Android10.0
说明
rk提供了几种预置apk的方案给到客户,具体的集成方案可见源码下文档(RKDocs/android/Rockchip_Introduction_Android_Application_Preinstallation_CN&EN.pdf)
测试发现预置其他apk正常,但是预置kodi打开提示找不到so库
分析
查看源码可知,rk的preinstall是在frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java中做了处理
private static void setNativeLibraryPaths(PackageParser.Package pkg, File appLib32InstallDir, int scanFlags) {
...
} else {
// Cluster install
if ((scanFlags & SCAN_AS_PREBUNDLED_DIR) != 0
|| (scanFlags & SCAN_AS_PREINSTALL) != 0) {
// mAppLib32InstallDir is the directory /data/app-lib which is used to store native
// libs for apps from the system paritition. It isn't really specific to 32bit info
// any way except for the variable name, the system will use the primary/secondary
// ABI computed below.
info.primaryCpuAbi = "armeabi-v7a";
info.nativeLibraryRootDir = new File(codeFile, LIB_DIR_NAME).getAbsolutePath();
Log.d(TAG, info.primaryCpuAbi + " prebundled install " + info.nativeLibraryRootDir);
} else {
info.nativeLibraryRootDir = new File(codeFile, LIB_DIR_NAME).getAbsolutePath();
}
info.nativeLibraryRootRequiresIsa = true;
info.nativeLibraryDir = new File(info.nativeLibraryRootDir,
getPrimaryInstructionSet(info)).getAbsolutePath();
if (info.secondaryCpuAbi != null) {
info.secondaryNativeLibraryDir = new File(info.nativeLibraryRootDir,
VMRuntime.getInstructionSet(info.secondaryCpuAbi)).getAbsolutePath();
}
}
他在这里指定了info.primaryCpuAbi = “armeabi-v7a”;
强制使用armv7的so库,但是kodi-arm64中只有arm64位的库无32位的.所以修改这里让其可以适配64位和32位即可,修改补丁如下:
-info.primaryCpuAbi = "armeabi-v7a";
+info.primaryCpuAbi = "arm64-v8a";
+info.secondaryCpuAbi = "armeabi-v7a";
编译后测试OK。
举报