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..?
-
1no dude i don't think so – Trikaldarshiii Jun 06 '12 at 11:23
-
please explain ..1- are you want to sign the same signed apk or new apk of same project...... – Dheeresh Singh Jun 06 '12 at 11:25
-
I want to resign the same apk – Rookie Jun 06 '12 at 11:26
-
Possible duplicate of [Can I re-sign an .apk with a different certificate than what it came with?](https://stackoverflow.com/questions/3267216/can-i-re-sign-an-apk-with-a-different-certificate-than-what-it-came-with) – Peter F Jan 07 '19 at 14:51
4 Answers
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
- Change the extension of your
.apk
to.zip
. - Open and delete the folder META-INF
- Change the extension to
.apk
Or
Command:zip [originalapk]
Example: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:
- To generate new key with keytool
keytool -genkey -alias -keystore
- To list keys
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

- 8,147
- 12
- 54
- 58

- 915
- 11
- 14
you should check below SO thread
Can I resign an .apk with a different certificate
or this one also may help you
-
what would be the path for this command..Jarsigner -verbose -keystore debug.keystore yourapk.apk aliasname – Rookie Jun 06 '12 at 11:43
You can also use the open-source apk-resigner script, which is very easy to use.
APK-resigner: https://github.com/onbiron/apk-resigner
./signapk.sh calculator.apk ~/.android/debug.keystore android androiddebugkey
Also if you want to sign the APK with your debug key, you may use.
./signapk.sh calculator.apk

- 1,419
- 18
- 31
- remove old sign
zip -d xxxx.apk(your apk file) META-INF/*
- sign apk
jarsigner -verbose -keystore xxxx.keystore(your keystore) -signedjar out_sign.apk(outfile) unsign.apk(unsign apk) xxxxxalias(your alias)
- if sign apk not work and jdk >= 1.7
add params -digestalg SHA1 -sigalg MD5withRSA
jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA -keystore xxxx.keystore(your keystore) -signedjar out_sign.apk(outfile) unsign.apk(unsign apk) xxxxxalias(your alias)

- 1,363
- 18
- 23