Currently I'm getting the apk signed with the private keystore file but I want to sign that apk with different keystore file. How can I resign that apk..?
apk file for resigning: Open up the . apk file in an archive manager and delete the entire META-INF directory with all of its contents. Ensure that the archive is saved upon closing it back up and keep the file extension as a .
When you sign an APK using the apksigner tool, you must provide the signer's private key and certificate. You can include this information in two different ways: Specify a KeyStore file using the --ks option. Specify the private key file and certificate file separately using the --key and --cert options, respectively.
You can resign your apk with different keystore.
Follow these steps:
Signing for release: $1.apk -> $1_release.apk"
Step 1: Removing any previous signing
.apk
to .zip
..apk
zip [originalapk]
zip "$1".apk -d
Step 2: Signing with release.keystore:
Command:
jarsigner –verbose –keystore [keystorefile] –signedjar [unalignedapk] [originalapk] alias_name
Example:
C:\Program Files\Java\jdk1.6.0_43\bin> jarsigner -verbose -keystore release.keystore -signedjar "$1"_unaligned.apk "$1".apk release
Step 3: Aligning
Command: zipalign -f 4 [unalignedapk] [releaseapk]
Example:
C:\Users\Downloads\adt-bundle-windows-x86\adt-bundle-windows-x86\sdk\too ls>zipalign -f 4 "$1"_unaligned.apk "$1"_release.apk
Step 4: Cleaning up
Command: rm 4 [unalignedapk]
Example: rm "$1"_unaligned.apk
Additional Commands might help:
keytool -genkey -alias -keystore
keytool -list -keystore
Note:
To sign our apks we have downgraded JDK from 1.7 to 1.6.0_43 update.
Reason:
As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK.
Command:
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias_name
you should check below SO thread
Can I resign an .apk with a different certificate
or this one also may help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With