Before mindlessly running commands n stuff lets get some concepts straight!!
Your app needs to get signed by a signing certificate / keystore (that .jks file) to create a release build. Release builds are created in either Debug mode or Release mode (We'll learn about this futher on)
There are 3 types of these keystore files that you will come across:-
Debug keystore generated by using ./gradlew signingReport (The debug keys is available by default when you create a flutter project)
Upload keystore generated by following these instructions (This is useful to create "release builds". So use this instead of debug keys)
Deployment keystore/Play Signing keystore which is automatically generated by Play Console when you first try to upload a app bundle there. (You can find it at Setup > App integrity > App signing). This keystore stays with Google. You do not have access to its .jks file. So its safe and wont get lost.
Now, I would say, if you wish to get your app on Play Store, DO NOT generate Debug keystore. Generate and ALWAYS use your Upload keystore only.
Why is this important?
- Debug keystore are just able to sign your apps in Debug mode (not Release mode).
Even if you try to use flutter build appbundle with --release flag, you are gonna get a app-release.aab which is signed in Debug mode! You can never publish an app signed in Debug mode in Play Store.
- Upload keystore can sign your app in Release mode which can be published on Play Store.
- Therefore, if you intend to publish your app in future, generate upload keystore by following these instructions and make changes to you gradle files accordingly. Do not generate that debug keystore cuz you wont need it.
This explanation should make you understand that why some answers are wrong which recommend to get a Debug keystore
Now the proper answer to the above question.
Certain Google Play services (such as Google Sign-in and App Invites) require you to provide the SHA-1 of your signing certificate
So if you are signing you app with upload keystore, add the SHA-1 fingerprint of your upload keystore in Firebase Console > Settings Icon > Project settings > Add fingerprint
You can get the SHA-1 of Upload keystore using keytool -v -list -keystore /path/to/upload-keystore.jks
Also, you can get the SHA-1 of Upload keystore and Deployment keystore on Play Console at Setup > App integrity > App signing
Which SHA-1 should I add? There are two SHA-1 at Play Console.
You have to add both SHA-1 fingerprints to firebase.
Why?
- For publish reviews you always have to submit your app signed with your Upload keystore. Play Console will accept your app update submission signed with that same Upload keystore only (So keep the Upload keystore safe). That's why, to make that Upload keystore signed App work properly you need to add SHA-1 of Upload keystore in Firebase.
- After your publish review is Accepted, your app will be signed again using the Deployment keystore by Play Console (automatic), then it will be published on Play Store. So that's why to make that Deployment keystore signed App work properly you need to add SHA-1 of Deployment keystore in Firebase.