I'm attempting to re-sign an Android .apk. i.e. It is currently self signed and I wish to re-sign it with the official certificate.
To do this I
- Download the build archive
- Rename it from name.apk to name.zip
- Extracting the zip
- Delete META-INF
- Zip back up the directory
- Rename the .zip back to .apk
- Sign the .apk with the official keystore using jarsigner
- Run zipalign against the signed .apk
But when I upload and run the .apk to a mobile it crashes when launched. This is caused by the following error
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
Sure enough when I check the console log I can see that zipalign is compressing this file
res/raw/my_file.wav (OK - compressed)
it should be doing this
res/raw/my_file.wav (OK)
How can I get zipalign is not compress my .wav files? Based on this answer Android should not be compressing .wav files.
I've also noticed a warning before running zipalign. i.e. It appears after I run 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.
What causes this message to appear? Seems likely that it is related.