0

I've an application built using Android Studio. Recently enhanced it using Ionic 3.0. When i'm trying to build with the same package name & certificate Google Play shows an error like SHA1 key differs.

  1. The package name remains same.
  2. Version info updated (6.0 as ionic, v5.0 already in google play prod)
  3. ionic cordova build --release android
  4. jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore sample.jks sample-unsigned.apk storekey
  5. zipalign.exe -v 4 sample-unsigned.apk prod.apk
  6. Google Play upload failed

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: 18:3B:40:F3:05:E6:03:1E:CA:CC:69:BF:BA:58:8A:BC:D9:65:28:83 ] //Not sure from where its being referred.

and the certificate(s) used to sign the APK you uploaded have fingerprint(s): [ SHA1: 71:16:65:C5:97:67:0D:4F:7A:D8:26:50:5A:C9:24:54:89:81:0E:BA ]

keytool -exportcert -keystore sample.jks -list -v prints the same key: SHA1: 71:16:65:C5:97:67:0D:4F:7A:D8:26:50:5A:C9:24:54:89:81:0E:BA

Any idea what i'm missing? Your suggestions are much appreciated.Thanks.

1 Answers1

0

It's exactly what the message says. You have signed with a different key. You can check this yourself.

Use unzip -p Name-of-apk.apk META-INF/CERT.RSA | keytool -printcert (from this SO answer) to print the details of your APK. Your previous APK is signed with one key, and your new APK is signed with another. I don't know how you signed your previous APK, only you know that.

Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37
  • Hi Nick, Thanks for your comment! – Sundarrajan Rajagopal Dec 25 '17 at 06:55
  • Hi Nick, I've printed the .rsa file and the key remain same. SHA1: 71:16:65:C5:97:67:0D:4F:7A:D8:26:50:5A:C9:24:54:89:81:0E:BA Previous APK built using Android Studio - Generate Signed APK option pointing the .jks file, the same .jks reused in Step #3 and #4 in my question. Your thoughts are welcome. – Sundarrajan Rajagopal Dec 25 '17 at 07:01