最近被客户一内置APK困扰了好一会,记录一下:
平台 :android11 SPRD
经过 :客制apk内置在系统中(加系统签名),固件升级没问题,但是apk方面要做升级,升级发现一直报错,提示升级不进去。 手动安装也报错。
ADB安装及报错如下:
adb install -r H:\work\____sign\___sign_9.0\system-m60b-release-unsigned1_sign.apk
Performing Streamed Install
adb: failed to install H:\work\____sign\___sign_9.0\system-m60b-release-unsigned1_sign.apk: Failure [-124: Failed parse during ins
tallPackageLI: Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary]
解决方法(按顺序来!):
1. 对齐(没有签名的apk: test-unsigned.apk)
zipalign -p -f -v 4 test-unsigned.apk test-unsigned_v4_sign.apk
2. 签名:
java -jar apksigner.jar sign --key platform.pk8 --cert platform.x509.pem test-unsigned_v4_sign.apk
这样就可以啦。
注意:
步骤1后面可以敲命令确认下有没有对齐(非必须): zipalign -c -v 4 o test-unsigned_v4_sign.apk
如果对齐会输出:Verification succesful
签名附件:后续传上,敬请期待...
如果有不懂的,可以看看下面两位仁兄写的精品文章(参考如下):
Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncom_学无止境-T的博客-优快云博客android 11安装apk 报错installed APKs to be stored uncompressed and aligned on a 4-byte boundary_jeephao的博客-优快云博客