简体   繁体   中英

Manual apk signing (jarsigner) vs automatic apk signing (android studio) - result is different APK

I just inherited an old project, which created back in 2013.

The guys used to build an unsigned apk, and then run those commands:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystore.keystore app-release-unsigned.apk alias
jarsigner -verify app-release-unsigned.apk    
zipalign -v 4 app-release-unsigned.apk app-release-signed.apk

And then upload the signed apk to play store.

However, when I generate signed apk with android studio, it results in apk with different signature.

As a result when I upload it to play store, it shows an error:

You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate. Your existing APKs are signed with the certificate(s) with fingerprint(s): SHA1: sha1..#1 and the certificate(s) used to sign the APK you uploaded have fingerprint(s): SHA1: sha1..#2

Is there a way to sign the apk with android studio so it results with same apk?

This is not the most convenient way to sign it manually...

Thanks

The keystore.keystore used by you should be the same as used by developers earlier. The one that is in Android Studio is being generated unique for each pc. You should find the correct keystore.keystore.

You need to use the same keystore.keystore file that the guys used before. From the error message, Google Play found that you were not using the same certificate (that was in the original keystore.keystore file).

Furthermore, if it was from 2013, it should be a V1 signature, so you need to select that and not V2, with android studio, if you prefer using android studio for the signing.

Almost two years ago a similar kind of problem was also happed to me. Although I had used Android Studio to generate the Keystore file in the first release and in the next update even though was using the same Keystore file but Play Store was showing me that error. I contacted the Play Store team and they provide me the new Keystore file with some steps to generate the new one. It took one or two weeks but finally, I was able to upload the APK. I suggest you to contact Play Store ( Play Console )Support. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM