60

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:

  1. added and linked my app in the Dev Console (game services)
  2. included the OAuth client id into my app/manifest
  3. added BaseGameActivity and GameHelper to my project (from GitHub)
  4. added the google-play-services library to my project
  5. 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.

rene
  • 41,474
  • 78
  • 114
  • 152
ottel142
  • 2,016
  • 1
  • 26
  • 37
  • 1
    Strange thing: I am having the same problem (I'm not the adminuser of the devconsole), but when the Admin is trying it, it works without any problem. – jhbruhn May 16 '13 at 19:45
  • 1
    Same issue with Admin on my side. – Hartok May 17 '13 at 02:56
  • 3
    Don't forget to delete the cache and content for Google Play Services app on your device. That one had me running in circles for about an hour. – you786 Oct 17 '13 at 20:21
  • I have to create 2 linked apps? – Tocco Jan 09 '14 at 13:22
  • Sorry ... But I have my two fingerprints in Google Developer Console but just the release one is working ... Any tip? TIA – Tocco Jan 09 '14 at 13:46

18 Answers18

30

I've fixed this issue.

In my case, when I've linked my app (not yet published) to my Google Play Game Services project, the Certificate Fingerprint auto-selected by Google Play was not the good one.

To fix that, I've deleted my app client ID on Google APIs Console, unlinked my app, then relinked it with the proper Certificate Fingerprint. This Fingerprint is displayed when exporting your app in Eclipse (if your ADT plugin is up-to-date).

Hope it helps.

Hartok
  • 2,147
  • 20
  • 37
  • 1
    Im doing what you say for the debug.keystore and it works, but when I do the same with my production keystore dont work. The game has to be published to test with production fingerprint? – PaNaVTEC May 19 '13 at 09:59
  • I think the SHA1 code was auto-selected wrongly for my app too. How did you manage to create another oath2 client id? – Habba May 20 '13 at 10:48
  • Just delete it on the Google APIs Console and unlink your game Google Play Dev Console. Then, relink the Game Service with your game and an new OAuth client will be created. – Hartok May 20 '13 at 17:59
  • 7
    Sorry, but how do you "unlink the game in the Google Play Dev Console" ? I can't see any button to do it in the console ... – bobygerm Feb 08 '14 at 20:54
  • 1
    I already published my game. Is there any hope left to get it working? I posted my detailed LogCat output [here](http://stackoverflow.com/questions/22507927/app-not-correctly-configured-to-use-google-play-game-services). – principal-ideal-domain Mar 19 '14 at 23:23
  • @bobygerm I really like to know that too. I can delete the app and add it again but I cannot give a new Sha1 fingerprint. Not that it should matter, my debug fingerprint should always be the same i guess. – Madmenyo Aug 01 '15 at 14:41
14

Had the same problem. My solution was to link the same package twice in the Dev Console, the first using the SHA1 fingerprint from my own certificate and the second using my debug key SHA1.

I had tried using just one or just the other before this and it hadn't worked for either.

  • 2
    This was my fix too. One complication: after adding a second linked app with the debug key our debug build still would not sign in (403 error etc). I think this is because Google Play Services had cached invalid credentials, either the failed login before I added the debug cert version, or the login from the prior build that used the production cert. The fix is to clear data and cache for Google Play services via the App settings. – mwk Jul 04 '13 at 01:08
  • @mwk, WOW thanks! That took me forever. I deleted the cache and data, and then I had to uninstall my app before it "forgot" about the bad certificate. – you786 Oct 17 '13 at 20:20
  • 2
    How do you set the SHA1 key for linked apps? I only know the [App & auth credential](https://console.developers.google.com/project/your-app-id/apiui/credential) page for setting SHA1 keys (in the link you have to replace your-app-id by your app id). But since the app id is global for you game I don't know how to distinguish between different linked apps. – principal-ideal-domain Mar 19 '14 at 23:18
14

After a long 2 weeks trying to fix this problem I have created steps for me to resolve this problem, and decided to share it with every one who is suffering from the same issue, this comes without publishing the game . it is used for testing. when publish time comes I will share the steps used to publish the app and make sure it works with Google play game service.

note that all I was trying to do is sign in using the Google sign in button with no action as to what should happen after sign it, also note that I have used BaseGameUtils from the Google play example as a library, and my IDE of choice to get all of this done was Eclipse.

Below are the steps one by one using eclipse:

1-import BaseGameUtils as a library in your eclipse work space, make sure no error occurs after the import. if an error occurred do the following:

a- right click on the BaseGameUtil project in project explorer

b-Click on Java build path

c-Click add external jars from there navigate to your SDK location and find Google-Play-services.jar

d-select it and click ok ---> you should see the jar added in the JARs and class folders window.

e-Go to the Order and export tab, on the right hand side of libraries and make sure "Android private libraries" and "Android Dependencies" are checked also ensure that the google-play-services.jar is selected.

2- Now make sure you reference your imported BaseGameUtility correctly in the app you want to use ," You can Create a simple hello world application to test this " , so now we will reference the BaseGameUtility in the hello world application as follows:

(important ensure Both hello world and BaseGameUtil are both in the same drive two drives will not work)

a-right click on the hello world application in the right hand side in project explorer

b-click on Java build path

c-Click on Libraries

d- add the android support-v4 if needed from an external or internal source (Not Required)

e- add the base game utils .jard by clicking on add class folder --> then select the BaseGameUtilProject ---Then select the /bin folder --This should import it to your application

f-add google-play-services.jar from an external source also if needed

g-in "order and export" ensure that you have the following selected --->"Android Private Libraries,Android dependancies ,BasegameUtils.jar,GooglePlayGameServices.jar" along with the normal SRC and GEN that should be selected by default.

3- now in your java file helloworld.java ensure that your main screen has all the required imports and then extend the BaseGameUtil and make sure the project implements the ViewOnClickListener.

4- Edit your android manifest to include the following:

 <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />

and

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

5- ensure that you have a ids.xml file in your resource to include your application ID after you create it.

<string name="app_id"></string>

You can leave it blank for now as later you will have to place the application ID in it

6-copy the debug key you have on your eclipse IDE before you add this application in the developer console. doing so in eclipse happens as follows:

a-click on Window b- select android c-Click build d- copy the SHA1 fingerprint and keep it to use it when creating your app in Developers console.

7- Create your game in developers console and use the SHA1 retrieved from step 6.

8- place the application ID in the ids.xml highlighted in step 5

9- double check your values and ensure that the package names are all correct between the developers console and the manifest file .

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
**package="com.helloword.check"**
android:versionCode="1"
android:versionName="1.0" >

10- When done ensure that the application in the developer console matches the SHA1 that is assigned in developer console using the keytool. This is the step that took me 2 weeks just to figure out

a- locate your application APK from the bin folder of your hello world project, and copy it to another location to check its ID with key tool later

b-locate your keytool --> usually located under the JAVA folder of your computer, in my case it was under C:\Program Files\Java\jdk1.7.0_09\jre\bin

c- Extract your apk in the temp location

d- run the following command

keytool -printcert -file "TempLocation\Meta-INF\CERT.RSA"

you will get an MD5 along with SHA1 and SHA256

Ensure that the SHA1 matches the one in the developers console.

11- Here is how to check your SHA1 from developers console,

a- go to Game Services

b- click the name of the game in our case helloWorld

c- Scroll down to "API Console Project"

d- You should see " this game is linked to the API console Project called helloworld"

e- helloworld should be a hyperlink click it,

f- this will open the Google APis Console

g- in APconsole click on API Access

h- scroll down to "Client IDs for installed application" , you should see the SHA1 ensure it is the same as the one generated from the keytool earlier in step 10 . ( if they don't match you have to delete the game from developers console and recreate it with the correct SHA1 ) " make sure not to change the SHA1 from Google APIs console this will cause issues.

I-Ensure the package name is the same package name in your android manifest, by that I mean everywhere package name is mentioned ensure it matches the one in " Client ID for installed applications" ( in my case it didn't match the one in the line 4 of my manifest)

And that is it you should now be able to test your sign in using google play game service

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dulli
  • 391
  • 3
  • 5
  • 3
    Thanks for your detailed explanation. I'm a little bit angered about Google, as there are still so many developers having problems with Google Play services. – ottel142 Aug 31 '13 at 18:51
  • 2
    No problem an i agree with you on how this was done, docs and not really clear, or partial at best. i could not find one page with every thing on it all i kept on seeing was a page with nested links which got really confusing. i am still working to test everything with Google Play services and i will keep posting any updates to this post. – Dulli Aug 31 '13 at 21:43
  • This answer is best tutorial for game services so far. – Alp May 30 '15 at 19:07
5

In Step 3. Generate an OAuth 2.0 client ID it specifically gives a warning as follows:

Warning: Do not open the Google APIs Console directly and manually add your Client IDs on that page. Doing so might cause errors when you send requests to the game services.

So my experience was that you need to follow the guide religiously: Setting Up Google Play Game Services with the Google Play Developer Console

Guy Kogus
  • 7,251
  • 1
  • 27
  • 32
Sachin Chavan
  • 5,578
  • 5
  • 49
  • 75
4

I was fighting this problem a lot. Changes in Google APIs Console only break OAuth Client ID- don't touch it. The only solution for me was to create new game service and connect signed apk with normal(not debug) key- because once you add apk with any key, if you will try again to add it with different key it will not work. Deleting game will not work, google will still remember the package name. You can try to change apk package name (of course it is not the best idea) and try again but it is not always work.

So once you will have this problem the best solution is to change apk package name and create new game service - this for sure always work- and please be careful with the game service name - don't make it with name you used earlier - it will mess up everything.

From few problems I have got with this service the funniest is that I now have my apk connected with game service but it is not listed in it and I cannot add it because of an error:This client ID is globally unique and is already in use- I think that client ID is not an OAuth ID - I cannot delete it - there is no such option- and maybe this is a root problem of what we got here.

3

Make sure that the ID that you enter in the meta-data is your app id, not your client id. And you can't hardcode it, as it must be an string, you must specify it in your resources and then reference it in your manifest.

Read this for more info:

https://developers.google.com/games/services/console/enabling#c_specify_client_id_settings

Note: For Android, you do not need to include the full client ID in your application, as it will be derived automatically from the application ID.

Alex Cabrera
  • 373
  • 1
  • 9
  • Thanks, but that's exactly the way I've included my id. – ottel142 May 16 '13 at 17:04
  • @alex what is the app id? Is it the package name? – Dittimon May 29 '13 at 04:33
  • 1
    Hi @Dittimon, the app_id is a 12 digit number (I think it's 12, don't remember exactly). It is generated when you authorize an app in your Game Service entry. It's generated in the form `123456789123.apps.googleusercontent.com`. You have only to put the 123456789123 part in the resources of your app. – Alex Cabrera May 31 '13 at 13:09
2

I'm experiencing similar issues and I see that this page was updated on 30th May 2013:

https://developers.google.com/games/services/android/troubleshooting

It may help some of us.

IanB
  • 3,489
  • 1
  • 20
  • 24
1

Guy, Have you correctly set up your account for testing ?

See https://developers.google.com/games/services/console/testpub#enabling_accounts_for_testing

If your game is in an unpublished state, you must whitelist the user accounts that you want to grant access for testing. Otherwise, your testers will encounter OAuth and 404 errors when attempting to access the game services endpoints.

This was the missing step for me. After that I didn't get those errors anymore :

E/GameAgent: Unable to retrieve 1P application 547xxxxxx457 from network
E/CheckGameplayAcl: Unable to load metadata for game

avianey
  • 5,545
  • 3
  • 37
  • 60
  • Are you sure you added it in the right place because there are two places for defining test accounts in the developper console : in the developper console parameters (wrong place) and in the game after the ranking step (right place) | anyway it worked for me and could help some people here ;-) – avianey May 17 '13 at 07:35
1

The trick that worked for me was to publish game services configuration since I already had an APK published for alpha testing.

For more details see paragraph "Other causes" in troubleshooting https://developers.google.com/games/services/android/troubleshooting

Ondřej Z
  • 5,094
  • 3
  • 24
  • 30
  • Thank you so much! I was adding games services to a game that was already published and apparently you can't do that. They both have to be either published or not. >.< I'll publish my game service later and see what happens. – Finnboy11 Jun 28 '13 at 16:30
1

Hartok's approach was helping me aswell, however "You might need to delete the projects from google api console." this sound sufficient, but it's not , at least not for me. Google has little "undelete" function in API Console. You can simply restore everything , this means they store your SHA-1 keys, but flagged as deleted(?). What worked for me to use the debug key again, which was also blocked, is that I undeleted all my test projects and manually deleted all OAuth Keys within "API Access" option from all those deleted projects, after that I could use my debug key again. Hope that helps someone...

CaptainCrunch
  • 1,230
  • 14
  • 15
1

Here's a checklist:

  1. First check if you haven't done any silly mistake or mismatches described on https://developers.google.com/games/services/android/troubleshooting
  2. A common problem is a conflicting 'app_id' resource id, for instance, if you're using a Facebook SDK it might be using a key with the same name, so double check that and rename the other ones in case you find conflicts. (I would keep the 'app_id' allocated to this project, as the BaseGameUtils library refers to it as 'app_id' in some source code I checked).

  3. Although the docs refer to 'Google Developers Console' don't play smart and try to add the Client ID's from there. Although, at the end, the Client ID's will be also end up there. There's a small note that can be easily misread:

You must create the new client ID in the Google Play Developer Console, not in the Google Developers Console.

  1. So based on this note, create your Client IDs only from the Google Play Developer Console, in other words, by 'Adding a linked app'. So you would usually create 2 linked apps one for using the 'debug.keystore' (using the same package, but with different fingerprints) and another 'linked app' for the 'production' keystore, yet using the same package, but with different fingerprints.

I think this covers all, most people might find themselves in a trap, as all looks fine in Google Developer Console, but in fact, they've probably missed the steps 3 and 4 above.

Alécio Carvalho
  • 13,481
  • 5
  • 68
  • 74
1

Thanks to Sachin Chavan finally solved it, the problems was:
1. Google play took the wrong sha1.
2. Tried to add it from the Google Developer Console - didnt work.
After looking at Sachin Chavan post and link, I saw you can link same app from Google Play Console multiple times, so I took the alias SHA1 with:

keytool -exportcert \
-alias <your-key-name> \
-keystore <path-to-production-keystore> \
-list -v

and the debug SHA1 with:

keytool -exportcert \
-alias androiddebugkey \
-keystore <path-to-debug-keystore> \
-list -v

I linked the app two more time, first time I entered the alias SHA1 and the second time the debug SHA1, after day of alot of errors, that solved it (the stages in bold).

LiranNis
  • 1,184
  • 1
  • 12
  • 14
0

Still not working for me. Google did a full reset of my Google Play Game Services, and did step by step the integration. Still said i doesn't have a registered google client ID. Pretty a failure, considering 3 years to make Google Play Games Services.

Last thing, account with @googlemail.com are not recognized, you can't export the IDs of the achievements (you need to copy past the html, when you have 40 achievements, it's quite a pain).

05-22 00:35:57.914: I/dqi(11166): I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond 05-22 00:35:57.914: I/dqi(11166): Retrying request 05-22 00:35:58.135: E/Volley(11166): [506] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/me 05-22 00:35:58.195: E/Volley(11166): [506] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/me 05-22 00:35:58.205: E/SignInIntentService(11166): Access Not Configured 05-22 00:35:58.205: E/SignInIntentService(11166): aol 05-22 00:35:58.205: E/SignInIntentService(11166): at ajy.a(SourceFile:108) 05-22 00:35:58.205: E/SignInIntentService(11166): at abm.a(SourceFile:213 05-22 00:35:58.205: E/SignInIntentService(11166): at abm.a(SourceFile:194) 05-22 00:35:58.205: E/SignInIntentService(11166): at aav.a(SourceFile:486) 05-22 00:35:58.205: E/SignInIntentService(11166): at aqu.a(SourceFile:221) 05-22 00:35:58.205: E/SignInIntentService(11166): at com.google.android.gms.games.service.GamesSignInIntentService.onHandleIntent(SourceFile:343) 05-22 00:35:58.205: E/SignInIntentService(11166): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 05-22 00:35:58.205: E/SignInIntentService(11166): at android.os.Handler.dispatchMessage(Handler.java:99) 05-22 00:35:58.205: E/SignInIntentService(11166): at android.os.Looper.loop(Looper.java:137) 05-22 00:35:58.205: E/SignInIntentService(11166): at android.os.HandlerThread.run(HandlerThread.java:60) 05-22 00:35:58.205: E/LoadSelfFragment(15328): Unable to sign in - application does not have a registered client ID
execomrt
  • 171
  • 2
  • 6
  • Adding a @googlemail.com account as a test account will indeed fail. Haha Google, c'mon! I've visited mail.google.com to migrate to [at]gmail.com ... – ottel142 May 22 '13 at 06:05
  • Small note, I almost gave up on this but then I realized the package name I put it didn't exactly match my "real app" as this was just a sample app turned into my official package name to see how it worked. Too bad you can't debug it without going through some major hurdles. – RelativeGames May 24 '13 at 06:46
0

In my case I forgot to change package name in AndroidManifest.xml; that was all. I think this should be checked first.

user2259824
  • 135
  • 8
0

Please, try this:

  1. Register your app as testing (if not published yet) (on Google developer site).
  2. Make some testing user id and register them over there.
  3. Now write your SHA1 id there.
  4. Note down your developer id generated by Google.
  5. Put it at appropriate place in your app.

If you already do that then follow this most important step.

6 - Now export your app with same keystore and now install it in your device (in which you have logged as tester id, registered on Google).
Now surely you will access Google real time server with out any error.

djf
  • 6,592
  • 6
  • 44
  • 62
AnkurJat
  • 404
  • 3
  • 9
0

Version ID! I had to change my version ID to a value greater than my most recent release. Suddenly I could log in!

For me, I was using a Sample (Button Clicker) and disguising it as one of my released apps. I probably still had to do all the SHA1 changing stuff since it seemed to be off, but the change that tipped in my favor was updating the version id to 3 since the sample starts at 1 and my real/published app was set at 2.

CodeMonkey
  • 1,795
  • 3
  • 16
  • 46
0

For me debug signing is working, signed not ;/ Can we contact google about this ? I have spend my all day on it;/ I get "there is no linked app associated with this client ID" but both of them are in Google Api under the right project.

Also i accidentally have two linked and published apps pointing into the same app_ID in developer console, both published and cannot be removed.

Paweł
  • 2,144
  • 1
  • 18
  • 25
0

Please check the internet connection when the app is running. If you are not connected, this error message is logged.