我正在尝试重新签署Android .apk。即现在是自签名的,我希望用官方证书重新签名。防止zipalign压缩.wav文件
要做到这一点,我
- 下载构建归档
- 从name.apk重命名为name.zip
- 解压缩ZIP
- 删除META-INF
- 邮编备份目录
- 将.zip重命名为.apk
- 将.apk签名为官方密钥库使用的jarsigner
- 运行的zipalign对.apk文件签署
但是当我上载和运行.apk文件到移动启动时崩溃。这是由以下错误
Caused by: android.content.res.Resources$NotFoundException: File res/raw/my_file.wav from drawable resource ID #0x7f070002
Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
果然当我检查控制台日志中我可以看到的zipalign被压缩这个文件
res/raw/my_file.wav (OK - compressed)
应该这样做
res/raw/my_file.wav (OK)
引起我怎样才能得到zipalign不压缩我的.wav文件?基于这个答案,Android不应该压缩.wav文件。
我也跑的zipalign前注意到一个警告。即它出现后我运行jarsigner
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2043-01-30) or after any future revocation date.
什么原因导致此消息出现?似乎可能是相关的。
但我怎么能避免压缩正式密钥库?现有的版本不会压缩wav文件,我希望这样做? –