When I'm creating an Android app with Google Maps, I'm supposed to restrict the google api key for the application using the SHA-1 fingerprint of the keystore.
I would like to do that before submitting the app bundle to the Play Store, so I tried using the keytool command that Google provides:
keytool -list -v -keystore your_keystore_name -alias your_alias_name
But I found out that when I upload the app bundle (.aab) to the Play Store, the map is not working, and I need to replace the previous SHA-1 with the one that appears on
Play Google Console -> MyApp -> Setup -> App Signing -> App signing key certificate
after I upload the bundle.
Is there a way to get the same SHA-1 certificate fingerprint before uploading the bundle? Why are they different anyway?
Thank you
When you created your first release, you were prompted whether you wanted to enroll in Play Signing and whether you wanted Play to create and store your app signing key. It seems that you have accepted. This means that Play will sign the APKs with the key they have created for you. You can read more about Play Signing here: https://support.google.com/googleplay/android-developer/answer/9842756
The key (and certificate) remain the same for the life of your app (unless you do some advanced operation like rotating app signing key), so the SHA-1 is not going to change and will always remain the same.
Note that if you create a new app, the SHA-1 is available in the App Signing page as soon as you enroll in Play Signing.