当前位置:   article > 正文

使用apktool 重新打包后安装失败_no signature found in package of version 2 or newe

no signature found in package of version 2 or newer for package

异常1:Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Scanning Failed.: No signature found in package of version 2 or newer for package xxx.xxx.xxx

使用   java -jar apksigner.jar verify -v XXX.apk 得知:

ERROR: Target SDK version 31 requires a minimum of signature scheme v2; the APK is not signed with this or a later signature scheme

错误:该APK开发的目标版本是31,需要有V2签名

再次执行 :java -jar apksigner.jar verify -v xxx.apk

Verified using v1 scheme (JAR signing): true
Verified using v2 scheme (APK Signature Scheme v2): true
Verified using v3 scheme (APK Signature Scheme v3): true
Verified using v4 scheme (APK Signature Scheme v4): false
Verified for SourceStamp: false
Number of signers: 1

异常2:Failure [-124: Failed parse during installPackageLI: Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary]

Android目标版本在30以上才会有的报错,没按4字节对齐

zipalign -p -f -v 4 infile.apk outfile.apk

异常3: Failed to collect certificates from /data/app/vmdl991791850.tmp/base.apk: META-INF/ABC_KEYS.SF indicates /data/app/vmdl991791850.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?

原文说证书收集失败,没有找到V2签名,通过android官网可知V2签名不是必须的,重新签一个部开起V2签名的apk再安装

异常4:[INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1445377762.tmp/base.apk: META-INF/ABC_KEYS.SF indicates /data/app/vmdl1445377762.tmp/base.apk is signed using APK Signature Scheme v3, but no such signature was found. Signature stripped?]

那就签名时关闭V3

依旧安装失败

1.修改AndroidManifest.xml 的编译版本,降低到30以下25以上

2.签名时V2还是得开启,v3可以关掉

Verified using v1 scheme (JAR signing): true
Verified using v2 scheme (APK Signature Scheme v2): true
Verified using v3 scheme (APK Signature Scheme v3): false
Verified using v4 scheme (APK Signature Scheme v4): false
Verified for SourceStamp: false

最终安装成功

提示:

先压缩,后签名

zipalign -p -f -v 4 old.apk new.apk

基本使用:

 解码: java -jar apktool.jar d xxx.apk

根据提示,还需签上自己的签名才能安装,下面先生成签名

keytool -genkey -alias abc.keystore -keyalg RSA -validity 20000 -keystore abc.keystore( abc.keystore 中的abc就是你签名的名称,这里名称随便命名,不能输入中文或中文符号) 命令运行后输入密码(自己设置一个密码,不做要求) 填写一下信息

签名:

java -jar apksigner.jar sign --ks abc.keystore --ks-key-alias abc.keystore --v2-signing-enabled true --v3-signing-enabled false --out new.apk --in old.apk

官网:Apktool - How to Install

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/161625
推荐阅读
相关标签
  

闽ICP备14008679号