playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 953 forks source link

[Bug] APK crashes after using PlayGamesSignIn in Unity Editor Version 2023.2.0f1 #3275

Closed Harsh-Khambhadiya closed 7 months ago

Harsh-Khambhadiya commented 7 months ago

[REQUIRED] Please fill in the following fields:

[REQUIRED]

Tried to create demo project to perform google play games sign in using Firebase authentication, for that I use the [GooglePlayGamesPlugin-0.11.01.unitypackage] and [FirebaseAuth] package after importing both just tried to build an apk with minimum target version of Android 9.0(API level 28) and maximum is Android 13.0 (API level 33) and then just build the apk after building i installed it on the device (S21 FE (Android 13)) then, at startup it shows little popup for playgames icon for validating after that app crashes.

// TODO(you): code here to reproduce the problem


using GooglePlayGames;
using GooglePlayGames.BasicApi;
using TMPro;
using UnityEngine;

public class Auth : MonoBehaviour
{
    public TextMeshProUGUI Detail;
    public string Token;

    void Awake()
    {
        PlayGamesPlatform.Activate();
    }

    void Start()
    {
        Debug.Log("Authenticate");
        PlayGamesPlatform.Instance.Authenticate(status =>
        {
            if (status == SignInStatus.Success)
            {
                Debug.Log("\nSuccess\nRequestServerSideAccess");
                PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
                {
                    Debug.Log("Authorization code: " + code);
                    Token = code;
                });

            }
            else Debug.Log("Failure");
        });
    }
}
AliKaanT commented 7 months ago

Hello similar issue here, for the past 3 days, im trying to implement play services in my game. I also have a game server and need to use "RequestServerSideAccess()" method. Unfortunately it shows popup and my username in the popup. My code is almost similar with yours the only diffrence is im usign Display.text = code instead of your Token = code but the text is not changes. Not event empty string or else. Are you able to get a code. Can you share the way you set up configs etc.

Harsh-Khambhadiya commented 7 months ago

I solved it by changing the target highest api level of the project and then reimport all packages and regenrate new GPGS token script with same credentials, also check the other plugins that conflict with the new editor version in my case there was Lunar Console that conflicting with these libraries so I needed to remove it from project.