After tampering with a signed apk using tools like smali/baksmali or even apktool here are the steps to rebuild and resign the Android application (from application root):
keytool -genkeypair -alias androiddebugkey -dname 'CN=Android Debug,O=Android,C=US' -keystore /tmp/debug.keystore -keyalg RSA -validity 10000
generate a valid Android debug keypair (Signing in Debug Mode) with password ‘android’ for both the keystore and the keys
rm -rf META-INF
if such exists
zip -9 -r out-unaligned.apk .
to zip things up
jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore /tmp/debug.keystore out-unaligned.apk androiddebugkey
sign it
zipalign 4 out-unaligned.apk out.apk
align it
keytool -printcert -jarfile out.apk
check it
adb install -s out.apk
install it (you may need to uninstall a previous version of the application in case of certificate errors
Published 13 years ago
by soulseekah
with no comments
tagged baksmali, jarsign, keytool, smali, zipalign in Android
baksmali jarsign keytool smali zipalign Android