GPGS Services - Unable to login (SOLVED)

Hello Defold-Gurus,

I am currently trying to integrate Google Play Game Services into my Project. Unfortunately i can’t get the login working. I always get the result:
message_id: gpgs.MSG_SIGN_IN
message[“status”]: gpgs.STATUS_FAILED
message[“error”]: Sign-in failed
thereby i followed these instructions: https://defold.com/extension-gpgs/

i tried this process multiple times, but i’m not sure whats going wrong (error message gives no details)
also in the Google Play Console everything looks set up fine and i double checked the app.id in the game.project config

any idea what could be the reason for this and how i can identify whats wrong?

Does the device log give any additional clues?

unfortunatly nothing helpful… :frowning:

Note: log switch off, only log_main and log_events will have logs!
--------- beginning of main
09-17 16:11:04.866 21787 21825 I defold : INFO:DLIB: Log server started on port 53436
09-17 16:11:04.870 21787 21825 I defold : INFO:ENGINE: Target listening with name: HUAWEI-HUAWEI VNS-L21 - 10.0.0.9 - Android
09-17 16:11:04.870 21787 21825 I defold : INFO:ENGINE: Engine service started on port 8001
09-17 16:11:04.870 21787 21825 I defold : INFO:ENGINE: Defold Engine 1.2.173 (fe2b689)
09-17 16:11:04.871 21787 21825 I defold : INFO:GpgsExt: Registered extension Gpgs
09-17 16:11:04.887 21787 21825 I defold : INFO:ENGINE: Loading data from: dmanif:game.dmanifest
09-17 16:11:04.989 21787 21825 I defold : INFO:ENGINE: Initialised sound device ‘default’
09-17 16:11:05.601 21787 21825 W defold : WARNING:ENGINE: Unknown Android input method [KeyEvent], defaulting to key events
09-17 16:11:06.218 21787 21825 I defold : INFO:DLIB: SSDP: Started on address 10.0.0.9

That log seems to only include messages from the defold engine.
I strongly suggest you read the full log to see what messages are output there.

@Mathias_Westerdahl thanks for that hint! indeed i can find something useful here:

PlayGamesServices[ValidateServiceOp]: ****
PlayGamesServices[ValidateServiceOp]: **** APP ID IS NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
PlayGamesServices[ValidateServiceOp]: **** Application ID ( 012345678912) must be a numeric value.
PlayGamesServices[ValidateServiceOp]: **** Please verify that your manifest refers to the correct project ID.
PlayGamesServices[ValidateServiceOp]: ****
PlayGamesServices[ValidateServiceOp]: **** For more information, refer to the troubleshooting guide:
PlayGamesServices[ValidateServiceOp]: **** https://developers.google.com/games/services/android/

if i check the AndroidManifext.xml which is created along with my apk i can find in there:
<meta-data
android:name=“com.google.android.gms.games.APP_ID”
android:value="\ 012345678912" />

my guess is that the whitespace before the app-id is causing problems. unfortunatly this comes from gpgs/manifests/android/AndroidManifest.xml where gpgs is a dependency folder, therefore i cant edit it. do you think my assumption is correct? is there anything i could try out as a workaround?

please be aware that i replaced the real app-id with 012345678912 - but for sure the real app id is a numeric value as well.

We’ve had that “space” there for a long, time, I doubt that is the actual issue.
What if you change the bogus app_id (012345678912) with your own app id?
Set the gpgs.app_id = <app id>" ingame.project`.

Yeah that is not a real app id. Please try with an actual id for a registered app.

I tried it with the real app id and only replaced it in this log message for privacy purposes (even though not sure if nescessary). Sorry for the confusion.

I found an workaround for now, here’s a detailed update of my findings:
no matter which number was used, the app was not able to login. after searching google for a little i found this discussion…


Please don’t be mad for posting links other game engine related stuff here :sweat_smile:

In this article people describe how they changed their android manifest to get rid of this issue.
I gave it a try by:

  • (re)building my project
  • adapting the AndroidManifest.xml in the build/armv7-android directory
    • i replaced:
    •     <meta-data
          android:name="com.google.android.gms.games.APP_ID"
          android:value="\ <app-id>" />
      
    • with:
    •     <meta-data
          android:name="com.google.android.gms.games.APP_ID"
          android:value="\u003<app-id>" />
      

… and suddenly sign-in worked!

Therefore the problem seems to be an encoding issue. Since i got curious i tried again, this time only removing the space character

  •     <meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="\<app-id>" />
    

What also worked! Therefore it seems the space character is causing (encoding?) issues on my system.

Is the space character intended to do something in particular? It seems that my system cant handle it during the bundle process (Ubuntu 18.04 64bit - building with the latest version of bob https://defold.com/manuals/bob/)
Would it be possible to change this in a place outside of the build directory? (Since i do not want to make this change manually everytime the manifest is generated)
Or even better, would it be of interest for you to adapt the gpgs repository since this seems to be a bug?

Thank you for the thorough debugging and testing! And please forgive me for this, but I have so many things going on that I forgot that this has been discussed before and that there’s actually a PR for this already: Change APP_ID manifest template. Fixes runtime GPG crash. by SkaterDad · Pull Request #24 · defold/extension-gpgs · GitHub

The thing is that bundling and running my own sample game worked on macOS, but I never considered that it could be OS related. We’ll go ahead and merge the PR! Please try the new release.

4 Likes

thanks for your quick releasing! :slight_smile:

everything seems to work now using the last release! :+1:

2 Likes

It’s comforting to know I wasn’t the only person with this issue. It hadn’t even crossed my mine that it would be OS related. I’m on Windows 10.

@britzl Thanks for merging the PR. Sorry for not answering the question, I must have the wrong email on Github.

1 Like