标签: Targeting R+; 4-byte boundary;APK 在ROM编译后没有显示;更换platform签名的坑;
安卓ROM编译里默认用谷歌自带签名文件,这是全世界公开的,每个公司都用自己的签名文件,更换了Android ROM公司自己的签名文件(platform.x509.pem, platform.pk8)。
ROM编译出来后,发现有个预置APK没有显示出来。看了安卓系统启动日志:
PackageManager: Failed to parse /androidres/priv-app/Test123456App: Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary
如果使用谷歌默认签名文件(platform.x509.pem,platform.pk8),APK都是正常显示。
参考 https://blog.csdn.net/guominyou/article/details/80564315
在build.gradle文件配置,增加了zipAlignEnabled为true
buildTypes {
release {
//Zipalign优化
zipAlignEnabled true
}
debug {
//Zipalign优化
zipAlignEnabled true
}
}
编译后,问题仍没有解决。
后参考这个文档
https://blog.csdn.net/qq_28768929/article/details/137039859
aaptOptions {
noCompress '.arsc'
}
编译后,问题仍没有解决。
后用命令
zipalign -c -v 4 outfile.apk
发现到 中文文件名时,字节码开始不对齐。
要求对方小组将APK里所有中文路径,所有中文文件名,全部换成英文,所有中文名除掉。
重新编译ROM,APK在安卓开机后,正常显示。
问题解决!!!
enjoy!!!
作者简介:https://shimo.im/docs/rp3OVwxle2fJn7Am/
上海徐汇
2024年6月9日