Android Sign In issues
Android Sign In can be tricky, since there are a lot of different settings inside Google Play console & Google API console you need to properly set and then sing your app with correspondent keys in order things to work. In case you will not find proper answers for your issue here, I would recommend to check out the Troubleshooting Issues in Your Android Game Google article.
So let's talk about common issues and ways to resolve it.
If sign-in is failed, it will give you the fail code, you can find code decision inside Common Status Codes doc. Let's talk about how to resolve some of those.
Most likely, you are signing your application with the wrong key.
First, make sure that you have followed the instructions to create your client IDs and configure the games services. If you still encounter sign-in errors, check the following items to make sure that your game is set up correctly.
Nex, Check the certificate fingerprint for the built APK
Find your certificate file and obtain its SHA1 fingerprint. To obtain the SHA1 fingerprint, run this command:
keytool -exportcert -alias your-key-name -keystore /path/to/your/keystore/file -list -v
Take note of the sequence of hexadecimal digits labeled
SHA1:in the output. That is your certificate's fingerprint.
Note: If you are using a debug certificate, replace
androiddebugkey in the command above. If using a release certificate, use the name you chose for your key when creating the certificate.
Next, check that your build tool is using this certificate:
- Generate your game's APK from your build tool and sign it with the desired certificate. Copy the generated APK to a temporary directory.
In the temporary directory, run the following command to unzip your APK.
Generate a private key using an RSA certificate file:
keytool -printcert -file META-INF/CERT.RSA
Alternatively, you can generate the private key using a DSA certificate file
keytool -printcert -file META-INF/CERT.DSA
Note the sequence of hexadecimal digits on the line labeled
This sequence of digits should match your certificate fingerprint from the previous step. If there is a mismatch, your build tool or system is not configured to sign your application with your certificate. In this case, consult your build environment's documentation to determine how to configure it correctly and try to sign in again.
Next, check if the certificate fingerprint matches the fingerprint configured in your client ID. To do this:
- Open the Google Play Console and navigate to your game.
- On the Game Details page, scroll to the bottom and click the link to the linked Google API Console project.
- In the Google API Console, select your project.
- In the sidebar on the left, select APIs & auth. Make sure that the Google Play games services API status is ON in the displayed list of APIs.
- In the sidebar on the left, select Registered apps.
- Expand the OAuth 2.0 Client ID section and note the certificate fingerprint (SHA1).
If this fingerprint does not match your certificate's fingerprint from the previous steps, you must create a new client ID with the correct certificate fingerprint. You must create the new client ID in the Google Play Console, not in the Google API Console.