Google Play Services - Sign In results in absolutely nothing . .

I had the same problem, when I click login nothing was happening. For my case the problem was Proguard. I got error from android log cat :

Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.GamesI fixed that by following the instructions here at the end of the page saying “Decreasing apk size”. There is a custom Proguard configuration file, I used that.

This is the proguard file I used :

-keep class com.google.android.gms.games.leaderboard.** { *; }
-keep class com.google.android.gms.games.snapshot.** { *; }
-keep class com.google.android.gms.games.achievement.** { *; }
-keep class com.google.android.gms.games.event.** { *; }
-keep class com.google.android.gms.games.stats.** { *; }
-keep class com.google.android.gms.games.video.** { *; }
-keep class com.google.android.gms.games.* { *; }
-keep class com.google.android.gms.common.api.ResultCallback { *; }
-keep class com.google.android.gms.signin.** { *; }
-keep class com.google.android.gms.dynamic.** { *; }
-keep class com.google.android.gms.dynamite.** { *; }
-keep class com.google.android.gms.tasks.** { *; }
-keep class com.google.android.gms.security.** { *; }
-keep class com.google.android.gms.base.** { *; }
-keep class com.google.android.gms.actions.** { *; }
-keep class com.google.games.bridge.** { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
-keep class com.google.android.gms.common.api.** { *; }
-keep class com.google.android.gms.common.data.DataBufferUtils { *; }
-keep class com.google.android.gms.games.quest.** { *; }
-keep class com.google.android.gms.nearby.** { *; }
1 Like

Proguard and Logcat to the people! This fixes the issue! Thanks

I had same problem callback was never called , now its fixed.
Try This:

  1. Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries.
  2. Assets > External Dependency Manager > Android Resolver > Force Resolve
1 Like

This worked for me. Thanks! It’s very important people… verify that you are using the Web Client (auto created by Google Service) Client ID… NOT the Android one.

1 Like

THANKS A LOT! YOU SAVED MY DAY!

I had the problem with callback not being called. After a full day I fixed with these steps:

  1. I had older version of the Play Games Plugin for Unity. I installed over it v11.01. So I had to manually delete all traces of the plugin from the project (Assets/Plugins/Android and Assets/Plugins/iOS). Then I re-installed v11.01.
  2. I made sure to have the Web Client OAuth Client ID from Google Console in the Client ID text box in Unity/Windows/Google Play Games/Setup/Android Setup. Maybe it would work without it.
  3. In the C# unity scripts I call first
PlayGamesPlatform.Activate();

Google’s documentation explicitly is saying not to call it and this is a mistake! Call it! Then

        Social.localUser.Authenticate((bool success) => {
            if (success)
            {
                  ...
            }
            else
            {
                  ...
            }
        });

Then such quick output would give you the actual online user data:

        if (allowUserPrint)
        {
            GUI.DrawTexture(new Rect(10, 300, 50, 50), Social.localUser.image);
            GUI.Label(new Rect(10, 360, 300, 50), Social.localUser.userName);
            GUI.Label(new Rect(10, 400, 300, 50), Social.localUser.id);
            GUI.Label(new Rect(10, 440, 300, 50), Social.localUser.state.ToString());

        }

These should be enough to indicate that you are using the actual google play account data. Any logout/login popups can be considered as next steps in your Google Play Games Auth journey.
4. If you try your Unity app in the Windows Unity Editor it will fail to initialize the Google Play Games plugin or call the Auth. Best it does is to provide you an offline dummy user. To try it for real I was using BlueStacks Android emulator for Windows. It has a quick way to upload the .apk generated by Unity. System Apps/Media Manager/Imported Files/Import from Windows. Also make sure you have a logged in google account in the BlueStacks.
5. My android app is registered in the Google Play Console. Its SHA1 footprint registered in Google Play Console matches with the private key by which the .apk is signed in Unity. Still it is good that the auth parts work in Bluestacks without having to upload the .apk in Firebase or Google Play Console.
6. Better feedback can be obtained by using this overload of the Authenticate method:

    PlayGamesPlatform.Instance.Authenticate(null,
    ProcessAuthentication3);
....
    internal void ProcessAuthentication3(bool succ, string res)
    {
        if (succ)
        {
            state = "success " + res ?? "null";
            Debug.Log("Success");
        }
        else
        {
            state = "unsuccess " + res ?? "null";
            Debug.Log("Unsuccess");
        }
    }