Game services not working for app if downloaded from play store

691 Views Asked by At

I've been trying to get the game services working properly for so long. My problem is that game service isn't working on the version downloaded from the play store, but on the version downloaded directly from android studio the game service works perfectly. Even though both versions use the same key and have the same SHA1 code (the release SHA1 code). I checked if the SHA1 from the play store version of my app matches with the game service's SHA1 by comparing the SHA1 codes from the android-release.apk and from https://console.developers.google.com/apis/credentials/oauthclient. I doubt that the problem lies in the code of my app, because it works perfectly in the version downloaded directly from android studio.

So my question is what I could have possibly done wrong here, and how to fix it.

Thank you for reading

3

There are 3 best solutions below

0
On BEST ANSWER

First off, I want to thank everyone who took their time to post an answer. I don't think anyone could have guessed my stupid mistake because it only applies to libGDX users. The problem was that the target sdk in the gradle .build file of BaseGameUtils was not the same as the .build file of the android module. It's amazing how such a small mistake can cost your whole weekend!

1
On

When using Google Play Services SDK, check and make sure that your device is also compatible and runs Android version 4.0 or higher and includes Google Play Store.

See this documentation for more information. And, this article wherein it discussed about matching Google Play Services to your Android OS version might also help

2
On

I had the same problem:

You need to use this:

keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v

example:

keytool -exportcert -keystore D:\Hristijan\Aplikacii\Keystore\blabla.jks -list -v

This is the PATH where you created the keystore while building the APK FILE.

The problem was that we were using the SHA1 key for debug in OAuth 2.0 client IDs, and as i understood SHA1 for debug and release is different.

So after you get the SHA1 for the release, you go to google cloud platform and in Credentials change your SHA1 for your app.