The basic steps for editing a system APK:
- Make a backup of the APK.
- Decompile working APK.
- Makes changes.
- Recompile working APK.
- Copy/paste both the META-INF folder and AndroidManifest.xml from the backup APK (which was never decompiled) into the recompiled working APK. Done!
META-INF contains the signature: that makes sense. But, what is the purpose of AndroidManifest.xml in retaining the original signature? I have tested this myself and Android would not load the APK with a recompiled AndroidManifest.xml (i.e. not an original AndroidManifest.xml).
Many guides state the necessity of copying both META-INF and AndroidManfest.xml from the original APK to the modded APK.
The closest answer I have found is that recompiling corrupts the AndroidManifest.xml (see http://rootzwiki.com/topic/268-guide-newbies-how-to-port-themes/), but I compared an original and post-recompiling AndroidManifest.XML and they're identical (says WinMerge and they have identical MD5 and SHA1 hashes). Another individual (http://miuiandroid.com/community/threads/q-remove-miui-torch-app.16013/) speculates that META-INF and AndroidManifest.xml are somehow tied to each other.
Everyone does this, but does anyone know why?