heisai / zipalign

兼容2G 以上 以及zip64 的对齐
30 stars 5 forks source link

windows 下对齐成功后,对apk进行V2签名时报错 #3

Open jinghaifeng1 opened 1 year ago

jinghaifeng1 commented 1 year ago

问题描述

我反编译并回编译了一个2.6G的APK,使用工具进行对齐,对齐成功.这是输出: "2697153175 zip_32的zip结构 文件总数:3510 当前索引 2697157234 zip_32的zip结构 文件总数:3510 开始校验请稍等 Verification Succesful... "

然后我使用 apksigner.bat 进行签名操作,签名时报错,报错信息如下: "Exception in thread "main" java.lang.IndexOutOfBoundsException: offset (2157672124) + size (2137295171) > source size (2696821131) at com.android.apksig.internal.util.FileChannelDataSource.checkChunkValid(FileChannelDataSource.java:186) at com.android.apksig.internal.util.FileChannelDataSource.feed(FileChannelDataSource.java:95) at com.android.apksig.ApkSigner.sign(ApkSigner.java:388) at com.android.apksig.ApkSigner.sign(ApkSigner.java:223) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)"

环境

heisai commented 1 year ago

你不签名,尝试用特殊的方式安装能否成功运行。

---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:31 收件人: @.>; 抄送: @.***>; 主题: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3)

问题描述

我反编译并回编译了一个2.6G的APK,使用工具进行对齐,对齐成功.这是输出: "2697153175 zip_32的zip结构 文件总数:3510 当前索引 2697157234 zip_32的zip结构 文件总数:3510 开始校验请稍等 Verification Succesful... "

然后我使用 apksigner.bat 进行签名操作,签名时报错,报错信息如下: "Exception in thread "main" java.lang.IndexOutOfBoundsException: offset (2157672124) + size (2137295171) > source size (2696821131) at com.android.apksig.internal.util.FileChannelDataSource.checkChunkValid(FileChannelDataSource.java:186) at com.android.apksig.internal.util.FileChannelDataSource.feed(FileChannelDataSource.java:95) at com.android.apksig.ApkSigner.sign(ApkSigner.java:388) at com.android.apksig.ApkSigner.sign(ApkSigner.java:223) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)"

环境

操作系统:windows10

python版本:3.10.0

apksigner 版本:SDK中 33.0.1

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jinghaifeng1 commented 1 year ago

你不签名,尝试用特殊的方式安装能否成功运行。 ---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:31 收件人: @.>; 抄送: @.>; 主题: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3) 问题描述 我反编译并回编译了一个2.6G的APK,使用工具进行对齐,对齐成功.这是输出: "2697153175 zip_32的zip结构 文件总数:3510 当前索引 2697157234 zip_32的zip结构 文件总数:3510 开始校验请稍等 Verification Succesful... " 然后我使用 apksigner.bat 进行签名操作,签名时报错,报错信息如下: "Exception in thread "main" java.lang.IndexOutOfBoundsException: offset (2157672124) + size (2137295171) > source size (2696821131) at com.android.apksig.internal.util.FileChannelDataSource.checkChunkValid(FileChannelDataSource.java:186) at com.android.apksig.internal.util.FileChannelDataSource.feed(FileChannelDataSource.java:95) at com.android.apksig.ApkSigner.sign(ApkSigner.java:388) at com.android.apksig.ApkSigner.sign(ApkSigner.java:223) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)" 环境 操作系统:windows10 python版本:3.10.0 apksigner 版本:SDK中 33.0.1 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

不签名会一直提示安装失败,特殊的方式是指?

heisai commented 1 year ago

我记得我们之前的测试,不签名也可以安装的。具体怎么搞,我不太清楚

---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:40 收件人: @.>; 抄送: @.**@.>; 主题: Re: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3)

你不签名,尝试用特殊的方式安装能否成功运行。 … ---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:31 收件人: @.>; 抄送: @.>; 主题: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3) 问题描述 我反编译并回编译了一个2.6G的APK,使用工具进行对齐,对齐成功.这是输出: "2697153175 zip_32的zip结构 文件总数:3510 当前索引 2697157234 zip_32的zip结构 文件总数:3510 开始校验请稍等 Verification Succesful... " 然后我使用 apksigner.bat 进行签名操作,签名时报错,报错信息如下: "Exception in thread "main" java.lang.IndexOutOfBoundsException: offset (2157672124) + size (2137295171) > source size (2696821131) at com.android.apksig.internal.util.FileChannelDataSource.checkChunkValid(FileChannelDataSource.java:186) at com.android.apksig.internal.util.FileChannelDataSource.feed(FileChannelDataSource.java:95) at com.android.apksig.ApkSigner.sign(ApkSigner.java:388) at com.android.apksig.ApkSigner.sign(ApkSigner.java:223) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)" 环境 操作系统:windows10 python版本:3.10.0 apksigner 版本:SDK中 33.0.1 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

不签名会一直提示安装失败,特殊的方式是指?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

jinghaifeng1 commented 1 year ago

我记得我们之前的测试,不签名也可以安装的。具体怎么搞,我不太清楚 ---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:40 收件人: @.>; 抄送: @.**@.>; 主题: Re: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3) 你不签名,尝试用特殊的方式安装能否成功运行。 … ---原始邮件--- 发件人: @.> 发送时间: 2023年7月10日(周一) 下午2:31 收件人: @.>; 抄送: @.>; 主题: [heisai/zipalign] windows 下对齐成功后,对apk进行V2签名时报错 (Issue #3) 问题描述 我反编译并回编译了一个2.6G的APK,使用工具进行对齐,对齐成功.这是输出: "2697153175 zip_32的zip结构 文件总数:3510 当前索引 2697157234 zip_32的zip结构 文件总数:3510 开始校验请稍等 Verification Succesful... " 然后我使用 apksigner.bat 进行签名操作,签名时报错,报错信息如下: "Exception in thread "main" java.lang.IndexOutOfBoundsException: offset (2157672124) + size (2137295171) > source size (2696821131) at com.android.apksig.internal.util.FileChannelDataSource.checkChunkValid(FileChannelDataSource.java:186) at com.android.apksig.internal.util.FileChannelDataSource.feed(FileChannelDataSource.java:95) at com.android.apksig.ApkSigner.sign(ApkSigner.java:388) at com.android.apksig.ApkSigner.sign(ApkSigner.java:223) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)" 环境 操作系统:windows10 python版本:3.10.0 apksigner 版本:SDK中 33.0.1 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.> 不签名会一直提示安装失败,特殊的方式是指? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

好的 我找找方法

osblow commented 11 months ago

我觉得我们应该遇到的是同一个问题. 我们今天调整了包体大小,apk 变成了2.3G. 发现zipalign.exe不管用了,就找到这个神器。确实对齐成功了,但是后面再用apksigner签名时失败: D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool>java.exe -jar C:\Dev\Android\Sdk\build-tools\31.0.0-rc2\lib\apksigner.jar sign --min-sdk-version 18 --ks D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\ApkTool/releaseNew.keystore --ks-key-alias xxxxxx --ks-pass pass:xxxxxxxx --out D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_Resign.apk D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_ForResign.apk Exception in thread "main" com.android.apksig.apk.ApkFormatException: Malformed ZIP entry: assets/main.obb.png at com.android.apksig.ApkSigner.sign(ApkSigner.java:385) at com.android.apksig.ApkSigner.sign(ApkSigner.java:214) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:373) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: com.android.apksig.zip.ZipFormatException: Compressed size mismatch between Local File Header and Central Directory for entry assets/main.obb.png. LFH: 2378960397, CD: 4294967295 at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:198) at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:127) at com.android.apksig.ApkSigner.sign(ApkSigner.java:382) ... 3 more

看起来像是对齐之后zip格式有变化导致apksigner解压不了,大佬有办法解决吗,万分感谢~~

jinghaifeng1 commented 4 months ago

我觉得我们应该遇到的是同一个问题. 我们今天调整了包体大小,apk 变成了2.3G. 发现zipalign.exe不管用了,就找到这个神器。确实对齐成功了,但是后面再用apksigner签名时失败: D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool>java.exe -jar C:\Dev\Android\Sdk\build-tools\31.0.0-rc2\lib\apksigner.jar sign --min-sdk-version 18 --ks D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\ApkTool/releaseNew.keystore --ks-key-alias xxxxxx --ks-pass pass:xxxxxxxx --out D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_Resign.apk D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_ForResign.apk Exception in thread "main" com.android.apksig.apk.ApkFormatException: Malformed ZIP entry: assets/main.obb.png at com.android.apksig.ApkSigner.sign(ApkSigner.java:385) at com.android.apksig.ApkSigner.sign(ApkSigner.java:214) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:373) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: com.android.apksig.zip.ZipFormatException: Compressed size mismatch between Local File Header and Central Directory for entry assets/main.obb.png. LFH: 2378960397, CD: 4294967295 at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:198) at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:127) at com.android.apksig.ApkSigner.sign(ApkSigner.java:382) ... 3 more

看起来像是对齐之后zip格式有变化导致apksigner解压不了,大佬有办法解决吗,万分感谢~~

我已经解决了我当初的问题了,现在才看到你的回复,你还需要么

leochenn commented 2 weeks ago

我觉得我们应该遇到的是同一个问题. 我们今天调整了包体大小,apk 变成了2.3G. 发现zipalign.exe不管用了,就找到这个神器。确实对齐成功了,但是后面再用apksigner签名时失败: D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool>java.exe -jar C:\Dev\Android\Sdk\build-tools\31.0.0-rc2\lib\apksigner.jar sign --min-sdk-version 18 --ks D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\ApkTool/releaseNew.keystore --ks-key-alias xxxxxx --ks-pass pass:xxxxxxxx --out D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_Resign.apk D:\ROWEXT_Release_P4_Android\A\MainClient\Tools\ShaderPipelineTool\temp-Android/result\ResignIPA_Shipping/Game_Shipping_ForResign.apk Exception in thread "main" com.android.apksig.apk.ApkFormatException: Malformed ZIP entry: assets/main.obb.png at com.android.apksig.ApkSigner.sign(ApkSigner.java:385) at com.android.apksig.ApkSigner.sign(ApkSigner.java:214) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:373) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: com.android.apksig.zip.ZipFormatException: Compressed size mismatch between Local File Header and Central Directory for entry assets/main.obb.png. LFH: 2378960397, CD: 4294967295 at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:198) at com.android.apksig.internal.zip.LocalFileRecord.getRecord(LocalFileRecord.java:127) at com.android.apksig.ApkSigner.sign(ApkSigner.java:382) ... 3 more 看起来像是对齐之后zip格式有变化导致apksigner解压不了,大佬有办法解决吗,万分感谢~~

我已经解决了我当初的问题了,现在才看到你的回复,你还需要么

想请教下,您是如何解决的?