8

I'm trying to use Google Play Game Services in my practice Android app.

I got the sign in buttons UI as explained in the developer guide. When I hit the sign in for the first time, it guides me through sign in process. Right after it's about to finish the process, it gives me a dialog with "Unknown error". After the first time, it always gives me this dialog after displaying the loading animation for a bit.

I imported BaseGameUtils and google-play-services_lib. I attached reference from BaseGameUtils to the google-play-services_lib. Then attached reference of these 2 to my game project.

I exported the project to get the SHA1 to put in the developer console. Then I have my 12 digit app id to place on the values/ids.xml (got the meta tag under application).

Tried cleaning the project, redoing the SHA1/keystore process and no luck. My email is under the testing access.

I read and tried the solutions provided on this question, but it was not my case.

Google Play Game Services - unable to sign in

Anybody experiencing the same or does anyone have a solution I should try?

Community
  • 1
  • 1
awonderer
  • 665
  • 9
  • 26
  • 1
    You could enable logs on BaseGameUtils and see all the logs to understand what is happening! There is a boolean flag there to enable it! – thiagolr May 23 '13 at 11:19
  • 1
    I am stuck with the same problem. Have tried to re-create Apps tokens etc... over and over again but could not get it to work. In LogCat, I see this error message: 05-26 09:38:31.494: E/Volley(9154): [524] il.a: Unexpected response code 401 for https://www.googleapis.com/games/v1/players/me 05-26 09:38:31.724: W/dqi(9154): Authentication error: Unable to respond to any of these challenges: {bearer=WWW-Authenticate: Bearer realm="https://www.google.com/accounts/AuthSubRequest", error=invalid_token} – Ulrich Scheller May 26 '13 at 07:45
  • Did you create the test accounts in the console? – Diego Palomar Sep 20 '13 at 14:53

5 Answers5

2

Try going to your Google+ settings on your device and purging the access that you had granted the app. Afterwards, MANUALLY set up Google+ for your test account, either through a PC/Mac web browser or through your device, then try re-linking the app. This worked for me.

Exact steps for Samsung Galaxy S3:

Settings -> Google -> Google+ -> Apps with Google+ Sign-In -> tap the app and at the bottom, tap Disconnect App.

For what it’s worth, I also tapped the option to “Delete all activity for this app” as well when I deleted it.

  • Today I had the same problem and the way I finally could solved it was doing the same as you indicate. – Diego Palomar Sep 20 '13 at 14:52
  • it helped me as well (-: I've installed a new version of my game and the device was not able to sign in to the application (game). I followed the instructions above and disconnected the app on my device. Then, I've connected again like a new user through my game. It worked. Thanks – Drorasta Feb 14 '14 at 01:25
1

Your ids.xml has to look like:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_id">XXXXXXXXX</string>
</resources>

And, in your manifest, you have to add:

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

Good luck!

  • but what should the value of app_id in the strings? Should it be the client id that you created on the dev console or the name of the app or the package name of the app? Cheers :) – Dittimon May 29 '13 at 02:57
  • OK, so the app ID is the 12 digit number at the start of the clientID that can also be seen at the top of your Google Play game services game in the dev Console – Dittimon May 29 '13 at 07:16
  • Yeah, that's what I have on my ids.xml. Thanks. – awonderer May 29 '13 at 22:11
1

I recommend utilising the debug log trace in the GameHelper class to get a clearer picture of the error. You can simply make a call in your onCreate to do this...

enableDebugLog(true, "fred"); where "fred" is the tag you want to show on logcat

It is most likely that you will then see an error like "OnConnection Failed result 4... SIGN IN REQUIRED. If you then search SO for that message you should be able to make some progress.

Another possibility:

I managed to get my own leaderboard into production last night. The error you are describing is one that I (and judging by other comments that I have seen in error reports on SO ) and other people have also encountered. I found that I was unable to use the google account that I user in the developer console to sign on, even though it is explicitly listed as a testing account for the game. I tried shutting down the emulator, deleting and redefining the game in the developer console etc. but I have never been able to get it to work.

I used a different account and I was able to sign on. I do not know what the problem is with my developer console account - I also use it in Google Plus without problems. Incidentally, I am still unable to use my developer account on the production app with a real device.

My advice is to use a separate account for testing. Good luck !

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

If you are using your production keystore to get the fingerprint, you need to export and use a release build. Otherwise, use the debug keystore to get the fingerprint.

According to https://developers.google.com/games/services/console/enabling#b_create_a_client_id - if using eclipse, the debug keystore is located at

~/.android/debug.keystore

One more thing, for me, I couldn't sign in using my publisher account but one of my other accounts worked ok. Maybe worth a try.

Dittimon
  • 986
  • 2
  • 14
  • 28
  • I haven't tried the debug keystore because I wanted to see the release version working. The release version is the exported build with the fingerprint given when exporting. I added the app id back and exported to install on my device. – awonderer May 29 '13 at 22:12
0

One additional thing that can be tried is to send (as attachment) the exported and signed yourapp.apk to the tester's account's email, and then install the app through email (by clicking on the attachment), and not through the usb.

It seems to me the problem here is not with play services, but with google+, as it sometimes takes several days for the changes (such as deleting some info) to take effect. If nothing works, create a new gmail account, and try again (that's what "worked" for me eventually :)).

Edit: old accounts that didn't work initially started working after 4 - 5 days. Maybe it just takes Google some time to synchronize everything.

k29
  • 1,859
  • 1
  • 15
  • 15