Christian Findlay
Christian Findlay

Reputation: 7682

Android Sign APK With Upload Certificate (How To Ensure Correct Fingerprint)

This is Google's documentation on signing an APK: https://developer.android.com/studio/publish/app-signing.html

The documentation seems fairly straight forward. I've been able to piece together process from various other pages, and from Stack Overflow threads. But, after I've signed the APK, the SHA-1 certificate fingerprint in the APK is wrong, which implies that I have not signed the APK with the correct certificate.

You uploaded an APK that is not signed with the upload certificate. You must use the same certificate. The upload certificate has fingerprint:

[ SHA1: FINGERPRINT ]

and the certificate used to sign the APK you uploaded have fingerprint:

[ SHA1: FINGERPRINT ]

My question is: how do I make sure that my generated keystore is using the Upload Certificate from the Google Play Console?

Here's what I did:

What steps am I missing?

Note: the Google doc says that this is the process for manually signing:

https://developer.android.com/studio/publish/app-signing.html#sign-manually

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk

But these steps don't use the upload certificate in any way...

All updates to your existing app must now be signed with your upload key. This will allow Google to verify your identity.

This makes complete sense. In essence, all I'm trying to do is sign the APK with my upload key from Google. I have the upload key. But, the step that Google hasn't documented is how to turn the upload key in to a keystore so that I can sign the APK with the keystore. It looks straight forward enough, but it's not working.

Upvotes: 3

Views: 3940

Answers (1)

Billy Liu
Billy Liu

Reputation: 2168

It seems you have lost your private keys. The Upload Certificate is the Certificate for your first upload app and created when you upload it. You need to use that .keystore file to sign your app.

how do I make sure that my generated keystore is using the Upload Certificate from the Google Play Console?

It's not possible. According to Google Manage your app signing keys:

Certificate: A certificate contains a public key as well as some extra identifying information about who owns the key.

The certificate doesn't contain the private key. So it could not used to create keystore.

The only way to solve this is that reset the upload key as said at the end of above article.

You refer to the following guides for publish app in xamarin:
Publishing to Google Play
Signing the Android Application Package
Manually Signing the APK

Upvotes: 1

Related Questions