Right after yesterday's Google I/O keynote I've updated my Android SDK to integrate the game services into one of my apps.
Things I've done so far:
- added and linked my app in the Dev Console (game services)
- included the OAuth client id into my app/manifest
- added
BaseGameActivity
and GameHelper
to my project (from GitHub)
- added the google-play-services library to my project
- extended
BaseGameActivity
, added a com.google.android.gms.common.SignInButton
I've also set up game meta data and, of course, some achievements. The dev console states that it is ready to release. To test the login flow and achievements, I've added two Google+ accounts as test users.
But when I test the SignInButton, an alert pops up: Unknown error. Here's the logcat:
ERROR/Volley: il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/me
ERROR/SignInIntentService: Access Not Configured
ERROR/LoadSelfFragment: Unable to sign in - application does not have a registered client ID
I've built my application in production mode - using ProGuard and the right certificate.
Did I miss something?
Update - some more attempts
Here's a short overview about what I've tried in the meantime. Nothing helped.
- remove and recreate the linked Android app entry (double checked certificate fingerprint)
- disable anti-piracy
- skip proguard
- create a new (test) game and use its client id
The problem is not related to the accounts for testing section. Using an account which is not enabled for testing will lead to another error message:
E/GameAgent: Unable to retrieve 1P application 547xxxxxx457 from network
E/CheckGameplayAcl: Unable to load metadata for game
Solution by Hartok!
Hartok's solution helped me a lot to fix this issue. I've never visited the Google APIs Console before. It's important to know, that the OAuth Client ID is not deleted when you remove a linked app from your game or even delete a game (in the Dev Console). You have to visit the APIs Console and remove it manually.
The auto-selected SHA1 fingerprint is (always) wrong! You have to lookup your own:
keytool -exportcert -alias <your-alias> -keystore <path-to-keystore> -list -v
The new client id of my (correctly) linked app looked like 89xxxxxxxx73-2u6mXXXXXXXXXXXXXXXXXXX8903.apps.goo...
, not just 12 digits as before. I finally figured out that you have to exclude the dash and alphanumeric stuff and have to use the 12 digits only.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…