网友通过本文主要向大家介绍了32bit和64bit的区别,32bit和64bit怎么看,64bit 32bit,32bit升级64bit,32bit和64bit哪个好等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
Android APK 在32bit 和64bit 的区别问题
目前64bitandroid系统也慢慢的多了,看到也有apk声称支持64bitsystem,然后就往里面打包搞了个arm64-v8a 目录,放了个64bit的so,但是apk代码里面却不按规范去load so ,导致一系列 file not found 异常。
apk lib目录:
先看下apk中的lib打包的目录:
依次代表不同类型的cpu
PMS安装路径://blog.csdn.net/sergeycao
pms install 流程比较繁杂,只关注so相关的scanPackageDirtyLI函数中:
private PackageParser.Package scanPackageDirtyLI(PackageParser.Package pkg, int parseFlags,
int scanFlags, long currentTime, UserHandle user) throws PackageManagerException {
...
//invoke installer to do the actual installation //作为外部apk 创建data目录相关项
//\frameworks\native\cmds\installd\commands.c install()中创建
int ret = **createDataDirsLI**(pkgName, pkg.applicationInfo.uid,
pkg.applicationInfo.seinfo);
...
if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg)) {
...
setBundledAppAbisAndRoots(pkg, pkgSetting);
...
setNativeLibraryPaths(pkg);
}
else
{
setNativeLibraryPaths(pkg);
...
if (isAsec) {
copyRet = NativeLibraryHelper.findSupportedAbi(handle, abiList);
} else {
copyRet = NativeLibraryHelper.copyNativeBinariesForSupportedAbi(handle,
nativeLibraryRoot, abiList, useIsaSpecificSubdirs);
}
setNativeLibraryPaths(pkg);
if (DEBUG_INSTALL) Slog.i(TAG, "Linking native library dir for " + path);
final int[] userIds = sUserManager.getUserIds();
synchronized (mInstallLock) {
// Create a native library symlink only if we have native libraries
// and if the native libraries are 32 bit libraries. We do not provide
// this symlink for 64 bit libraries.
if (pkg.applicationInfo.primaryCpuAbi != null &&
**!VMRuntime.is64BitAbi(pkg.applicationInfo.primaryCpuAbi)**) {
final String nativeLibPath = pkg.applicationInfo.nativeLibraryDir;
for (int userId : userIds) {
if (mInstaller.linkNativeLibraryDirectory(pkg.packageName, nativeLibPath, userId) < 0) {
throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
"Failed linking native library dir (user=" + userId + ")");
}
}
}
}
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36