Unity/Unity 이슈

Unity 구글 로그인 실패 Case #1

lipnus 2022. 12. 23. 20:36
반응형

Problem

원래 잘 되던 구글로그인이 라이브러리 업데이트 후 먹통이 됨

Google 아이디로 로그인 버튼을 눌렀을 때

APK로 빌드 후 Phone에서 실행 시 아래와 같은 로그(Exception에러는 아님)

 

  : Returning an error code. 
   : GooglePlayGames.Android.<>c__DisplayClass18_0:<Authenticate>b__0(Int32) 
   : System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) 
   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[]) 
   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr) 
   :  
   : ### Username:  
   : User ID:  
   : IsUnderage: True 
   : GoogleAuthManager:<SignInGoogle>b__2_0(Boolean) 
   : GooglePlayGames.<>c__DisplayClass33_0:<Authenticate>b__0(SignInStatus) 
   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() 
   :  
   : ### 로그인 성공? : False 
   : GoogleAuthManager:<SignInGoogle>b__2_0(Boolean) 
   : GooglePlayGames.<>c__DisplayClass33_0:<Authenticate>b__0(SignInStatus) 
   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() 

 

 

public void SignInGoogle()
{
    if (!Social.localUser.authenticated)
    {
        Social.localUser.Authenticate(success =>
        {
            var userInfo = "Username: " + Social.localUser.userName + 
                           "\nUser ID: " + Social.localUser.id + 
                           "\nIsUnderage: " + Social.localUser.underage;
            Debug.Log ($"### {userInfo}");


            Debug.Log($"### 로그인 성공? : {success}");
            if (success) {
                OnGoogleSignIn.Invoke(true);
            }
            else {
                OnGoogleSignIn.Invoke(false);
            }
        });
    }
}

 

 

 

Solution

Web Client가 아니라 두번째 것으로 입력되어 있었음
넣고 Success 윈도우 뜨고 다시 빌드

 

사용버전

Unity 2021.3.14f1

GooglePlayGamesPlugin-0.10.14
GoogleMobileAds-v7.3.1.unitypackage

firebase_unity_sdk_10.3.0

 

(22. 12. 23 현재 거의 최신버전)

반응형