Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApkNormalized对Apk正则化之后使用7zip解压出现问题 #67

Closed
Picasso1990 opened this issue Oct 30, 2020 · 6 comments · Fixed by #68
Closed

ApkNormalized对Apk正则化之后使用7zip解压出现问题 #67

Picasso1990 opened this issue Oct 30, 2020 · 6 comments · Fixed by #68

Comments

@Picasso1990
Copy link

Picasso1990 commented Oct 30, 2020

出现原因:当apk中的assets中存在一个空文件(可以自己随便创建一个文本为空的文件),这时候使用ApkNormalized进行正则化之后,再使用7 zip工具进行解压,会出现错误,错误日志为:数据错误assets/nullfile

请问出现该错误的原因是什么呢?您那边方便分析一下吗?

备注:自己随便造一个apk都会出现该错误

@sisong
Copy link
Owner

sisong commented Nov 8, 2020

收到问题。
我在macos下,用系统自带的压缩生成的zip文件,使用ApkNormalized处理后,用系统或keka都能正确解压,windows下用7zip解压能够复现报错(看起来正确解压但会有错误日志)。而换用keka来创建zip就无法复现该问题;

@sisong
Copy link
Owner

sisong commented Nov 8, 2020

可能的原因: 生成的zip文件中如果是0字节的文件,并且使用了deflate算法,那么在ApkNormalized的时候,就不会保存任何文件的数据,这和7zip的默认逻辑不匹配(没有数据来解压)。

@sisong
Copy link
Owner

sisong commented Nov 9, 2020

我试了一下,构造了一个这样的apk文件,7zip解压报错,但还是能够正确的安装和运行在一步华为手机上。

@Picasso1990
Copy link
Author

是的,能够正常运行,是否有办法使7zip解压正确呢?根据“那么在ApkNormalized的时候,就不会保存任何文件的数据”,这个是不是在ApkNormalized中可以使原本apk中有什么样的文件就以怎么样的形式保存呢?

额外的问题:如果我原本的apk中游戏文件是经过压缩的,有些文件是没有经过压缩的,那么使用了ApkNormalized之后这些文件的压缩性有正确的保存下来吗?

@sisong
Copy link
Owner

sisong commented Nov 9, 2020

额外的问题:如果我原本的apk中游戏文件是经过压缩的,有些文件是没有经过压缩的,那么使用了ApkNormalized之后这些文件的压缩性有正确的保存下来吗?

当前ApkNormalized不会去改变文件是否压缩的属性(但要修改该问题可能会调整策略)。

是否有办法使7zip解压正确呢?

会尝试修改一下ApkNormalized的流程,保留0字节大小的压缩文件的压缩数据(这会破坏旧的patch的流程造成不兼容); 还有一种简单修改ApkNormalized的方式:遇到0字节的压缩文件时属性修改为不压缩就不会破坏旧的patch的流程了。

@sisong
Copy link
Owner

sisong commented Nov 29, 2020

更新了一个新版本,ApkNormalized出来的zip包可以用7zip兼容打开了,并且默认时不影响部署的旧patch;

sisong added a commit that referenced this issue Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants