안드로이드 로그인 undefined google_hash, google_hash을(를) 확인할 수 없습니다

안드로이드에서 뒤끝 로그인이 안되는 문제가 있어 글 남겨요
Google Hash Key는 있지만 혹시
Google Hash Key 없이 앱을 실행 할 방법이 없을까요?

Proguard 은 사용하지 않지만 예외 정보를 입력후 다시 해보라는 글이 있어서 해봤습니다
image

-keep class io.thebackend.unity.** {
    *;
}
-keep class io.thebackend.webview.** {
    *;
}

위와 같이 설정을 추가해도 로그인이 안돼요

  • 뒤끝 SDK 버전 : 5.18.0
  • 프로젝트명 : TheHacker
  • 스테이터스 코드 : 400
  • 에러 코드 :
    [Header("로그아웃 버튼추가")]
    public Button logoutButton;

    
    public static GoogleLoginManager Instance;
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject); // 씬이 바뀌어도 오브젝트가 파괴되지 않도록 설정
    }

    // Firebase 인증 관련 객체
    FirebaseAuth auth;
    FirebaseUser user;

    // 사용자 정보 표시용 UI 요소
    private string Username, UserEmail, UserId;

    //확인용
    public TextMeshProUGUI tUsername, tUserEmail, tUserId;
    public Image UserProfilePic;
    // 프로필 이미지 URL 및 초기화 상태
    private string imageUrl;
    private bool isGoogleSignInInitialized = false;

    /// <summary>
    /// 컴포넌트가 시작될 때 Firebase 초기화 및 로그인 시도
    /// </summary>
    private void Start()
    {
        logoutButton.onClick.AddListener(Logout);
        InitFirebase();
        Login();
    }
    /// <summary>
    /// Firebase 인증 객체 초기화
    /// </summary>
    void InitFirebase()
    {
        auth = FirebaseAuth.DefaultInstance;
    }


    /// <summary>
    /// Google 계정으로 로그인 시도 및 결과 처리
    /// </summary>
    private void Login()
    {
        // 에디터에서만 사용되는 코드 #if
#if UNITY_EDITOR
        BackendManager.Instance.OnBackendLogin("mytestusesr05", "mytestusesr05email");
#endif

        // 안드로이드에서만 사용되는 코드 #if
#if UNITY_ANDROID
        // Google Sign-In 설정 초기화
        if (!isGoogleSignInInitialized)
        {
            GoogleSignIn.Configuration = new GoogleSignInConfiguration
            {
                RequestIdToken = true,
                WebClientId = GoogleAPI,
                RequestEmail = true
            };

            isGoogleSignInInitialized = true;
        }
        // 매번 Sign-In 시도 시에도 설정 적용
        GoogleSignIn.Configuration = new GoogleSignInConfiguration
        {
            RequestIdToken = true,
            WebClientId = GoogleAPI
        };
        GoogleSignIn.Configuration.RequestEmail = true;

        // Google 로그인 비동기 작업 시작
        Task<GoogleSignInUser> signIn = GoogleSignIn.DefaultInstance.SignIn();

        TaskCompletionSource<FirebaseUser> signInCompleted = new TaskCompletionSource<FirebaseUser>();
        signIn.ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                signInCompleted.SetCanceled();
                Debug.Log("Cancelled");
                print("인증 실패로 프로그램을 종료합니다.");
                Application.Quit();
            }
            else if (task.IsFaulted)
            {
                signInCompleted.SetException(task.Exception);
                Debug.Log("Faulted " + task.Exception);
                print("인증 실패로 프로그램을 종료합니다.");
                Application.Quit();
            }
            else
            {
                // Google 인증 토큰으로 Firebase 인증 시도
                Credential credential = Firebase.Auth.GoogleAuthProvider.GetCredential(((Task<GoogleSignInUser>)task).Result.IdToken, null);
                auth.SignInWithCredentialAsync(credential).ContinueWith(authTask =>
                {
                    if (authTask.IsCanceled)
                    {
                        signInCompleted.SetCanceled();
                        // 인증이 취소된 경우 프로그램 종료 
                        print("인증 실패로 프로그램을 종료합니다.");
                        Application.Quit();
                    }
                    else if (authTask.IsFaulted)
                    {
                        signInCompleted.SetException(authTask.Exception);
                        Debug.Log("Faulted In Auth " + task.Exception);
                        // 인증 실패 program 종료
                        print("인증 실패로 프로그램을 종료합니다.");
                        Application.Quit();
                    }
                    else
                    {
                        // 인증 성공 시 사용자 정보 UI에 표시 및 프로필 이미지 로드
                        signInCompleted.SetResult(((Task<FirebaseUser>)authTask).Result);
                        Debug.Log("Success");
                        user = auth.CurrentUser;
                        Username = user.DisplayName;
                        UserEmail = user.Email;
                        UserId = user.UserId;
                        // 뒤끝 로그인
                        BackendManager.Instance.OnBackendLogin(UserId, UserEmail);

                        tUserEmail.text = UserEmail;
                        tUsername.text = Username;
                        tUserId.text = UserId;
                        print("user HashCode" + user.GetHashCode());
                        StartCoroutine(LoadImage(CheckImageUrl(user.PhotoUrl.ToString())));


                    }
                });
            }
        });


#endif
    }

    /// <summary>
    /// 프로필 이미지 URL이 유효한지 확인 후 반환
    /// </summary>
    private string CheckImageUrl(string url)
    {
        if (!string.IsNullOrEmpty(url))
        {
            return url;
        }
        return imageUrl;
    }

    /// <summary>
    /// 주어진 이미지 URL로부터 이미지를 비동기적으로 로드하여 UI에 표시
    /// </summary>
    IEnumerator LoadImage(string imageUri)
    {
        UnityWebRequest www = UnityWebRequestTexture.GetTexture(imageUri);
        yield return www.SendWebRequest();

        if (www.result == UnityWebRequest.Result.Success)
        {
            Texture2D texture = DownloadHandlerTexture.GetContent(www);
            // 로드된 텍스처를 UI 이미지로 적용
            Debug.Log("Image loaded successfully");
            UserProfilePic.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));


        }
        else
        {
            Debug.Log("Error loading image: " + www.error);
        }
    }

    private void Logout()
    {
        // Firebase 로그아웃
        auth.SignOut();
        // Google 로그아웃
        GoogleSignIn.DefaultInstance.SignOut();
        Debug.Log("User logged out");
        
        // UI 초기화
        tUsername.text = "Not logged in";
        tUserEmail.text = "Not logged in";
        tUserId.text = "Not logged in";

        UserId = string.Empty;
        Username = string.Empty;
        UserEmail = string.Empty;
        UserProfilePic.sprite = null; // 프로필 이미지 초기화

        print("로그아웃 하여 프로그램 종료합니다.");
        // end
        Application.Quit();
    }
  • 에러 메시지 :
    2025-07-22 13:45:06.393 19779 19819 Error Unity Backend Util Android AAR Issue : java.lang.ClassNotFoundException: io.thebackend.unity.Utils.CommonUtil
    2025-07-22 13:45:06.393 19779 19819 Error Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    2025-07-22 13:45:06.393 19779 19819 Error Unity BackEnd.Functions.AndroidFunctions:.ctor()
    2025-07-22 13:45:06.393 19779 19819 Error Unity System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
    2025-07-22 13:45:06.393 19779 19819 Error Unity System.Activator:CreateInstance()
    2025-07-22 13:45:06.393 19779 19819 Error Unity System.Lazy1:ViaFactory(LazyThreadSafetyMode) 2025-07-22 13:45:06.393 19779 19819 Error Unity System.Lazy1:ExecutionAndPublication(LazyHelper, Boolean)
    2025-07-22 13:45:06.393 19779 19819 Error Unity System.Lazy`1:CreateValue()
    2025-07-22 13:45:06.393 19779 19819 Error Unity BackEnd.Backend:avJ7p3rmx(BackendCustomSetting)
    2025-07-22 13:45:06.393 19779 19819 Error Unity BackEnd.Backend:Initialize(BackendCustomSetting)
    2025-07-22 13:45:06.393 19779 19819 Error Unity BackEnd.Backend:Initialize()
    2025-07-22 13:45:06.393 19779 19819 Error Unity BackendManager:Start()
    2025-07-22 13:45:06.393 19779 19819 Error Unity

2025-07-22 13:45:09.855 19779 19916 Info Unity 회원가입을 요청합니다.
2025-07-22 13:45:09.855 19779 19916 Info Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
2025-07-22 13:45:09.855 19779 19916 Info Unity BackendLogin:CustomSingUp(String, String)
2025-07-22 13:45:09.855 19779 19916 Info Unity BackendManager:OnBackendLogin(String, String)
2025-07-22 13:45:09.855 19779 19916 Info Unity <>c__DisplayClass17_1:b__1(Task1) 2025-07-22 13:45:09.855 19779 19916 Info Unity System.Threading.Tasks.Task:Execute() 2025-07-22 13:45:09.855 19779 19916 Info Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean) 2025-07-22 13:45:09.855 19779 19916 Info Unity System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&) 2025-07-22 13:45:09.855 19779 19916 Info Unity System.Threading.Tasks.Task:ExecuteEntry(Boolean) 2025-07-22 13:45:09.855 19779 19916 Info Unity System.Threading.ThreadPoolWorkQueue:Dispatch() 2025-07-22 13:45:09.855 19779 19916 Info Unity 2025-07-22 13:45:09.957 19779 19916 Error Unity 회원가입에 실패했습니다. : StatusCode : 400 2025-07-22 13:45:09.957 19779 19916 Error Unity ErrorCode : UndefinedParameterException 2025-07-22 13:45:09.957 19779 19916 Error Unity Message : undefined google_hash, google_hash을(를) 확인할 수 없습니다 2025-07-22 13:45:09.957 19779 19916 Error Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) 2025-07-22 13:45:09.957 19779 19916 Error Unity BackendManager:OnBackendLogin(String, String) 2025-07-22 13:45:09.957 19779 19916 Error Unity <>c__DisplayClass17_1:<Login>b__1(Task1)
2025-07-22 13:45:09.957 19779 19916 Error Unity System.Threading.Tasks.Task:Execute()
2025-07-22 13:45:09.957 19779 19916 Error Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
2025-07-22 13:45:09.957 19779 19916 Error Unity System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&)
2025-07-22 13:45:09.957 19779 19916 Error Unity System.Threading.Tasks.Task:ExecuteEntry(Boolean)
2025-07-22 13:45:09.957 19779 19916 Error Unity System.Threading.ThreadPoolWorkQueue:Dispatch()
2025-07-22 13:45:09.957 19779 19916 Error Unity
2025-07-22 13:45:09.957 19779 19916 Info Unity 로그인을 요청합니다.
2025-07-22 13:45:09.957 19779 19916 Info Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
2025-07-22 13:45:09.957 19779 19916 Info Unity BackendLogin:CustomLogin(String, String)
2025-07-22 13:45:09.957 19779 19916 Info Unity BackendManager:OnBackendLogin(String, String)
2025-07-22 13:45:09.957 19779 19916 Info Unity <>c__DisplayClass17_1:b__1(Task1) 2025-07-22 13:45:09.957 19779 19916 Info Unity System.Threading.Tasks.Task:Execute() 2025-07-22 13:45:09.957 19779 19916 Info Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean) 2025-07-22 13:45:09.957 19779 19916 Info Unity System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&) 2025-07-22 13:45:09.957 19779 19916 Info Unity System.Threading.Tasks.Task:ExecuteEntry(Boolean) 2025-07-22 13:45:09.957 19779 19916 Info Unity System.Threading.ThreadPoolWorkQueue:Dispatch() 2025-07-22 13:45:09.957 19779 19916 Info Unity 2025-07-22 13:45:10.035 19779 19916 Error Unity 로그인이 실패했습니다. : StatusCode : 400 2025-07-22 13:45:10.035 19779 19916 Error Unity ErrorCode : UndefinedParameterException 2025-07-22 13:45:10.035 19779 19916 Error Unity Message : undefined google_hash, google_hash을(를) 확인할 수 없습니다 2025-07-22 13:45:10.035 19779 19916 Error Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) 2025-07-22 13:45:10.035 19779 19916 Error Unity BackendManager:OnBackendLogin(String, String) 2025-07-22 13:45:10.035 19779 19916 Error Unity <>c__DisplayClass17_1:<Login>b__1(Task1)
2025-07-22 13:45:10.035 19779 19916 Error Unity System.Threading.Tasks.Task:Execute()
2025-07-22 13:45:10.035 19779 19916 Error Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
2025-07-22 13:45:10.035 19779 19916 Error Unity System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&)
2025-07-22 13:45:10.035 19779 19916 Error Unity System.Threading.Tasks.Task:ExecuteEntry(Boolean)
2025-07-22 13:45:10.035 19779 19916 Error Unity System.Threading.ThreadPoolWorkQueue:Dispatch()
2025-07-22 13:45:10.035 19779 19916 Error Unity

안녕하세요 개발자님,
구글 로그인 SDK 사용 및 시 다음 예외 사항을 추가해 주셔야 합니다.

-keep class io.thebackend.googlelogin.* {*;}
-keep class io.thebackend.googlelogin.GoogleLogin {*;}
-keep class io.thebackend.googlelogin.BackendGoogleLoginCallback {*;}
-keep class io.thebackend.googlelogin.BackendOnUnityCallback {*;}

위 내용 적용 후 Android Resolver에서 Force Resolve도 진행하여 확인 바랍니다.

적용 후에도 동일 현상이 발생하시는 경우 사용하고 계신 유니티 버전을 확인 요청드립니다.

유니티 버전은
unity 6000.0.51f1

-keep class io.thebackend.googlelogin.* {;}
-keep class io.thebackend.googlelogin.GoogleLogin {
;}
-keep class io.thebackend.googlelogin.BackendGoogleLoginCallback {;}
-keep class io.thebackend.googlelogin.BackendOnUnityCallback {
;}
를 추가하고

Resolve,Force Resolve 하였습니다

하지만 동일한 형상이 계속 발생하여
안드로이드에 뒤끝 커스텀 로그인을 할 수 없습니다.

해결됐어요!!!
그냥 Backend-5.18.0 를 다시 임포트 하니까 해결됐어요

좋아요 1

담당부서 확인 시 GetHashCode를 반환하는 aar 파일의 설치가 잘못되었던 것으로 예상됩니다.
재설치 안내가 필요했던 부분으로 해결되셨다니 다행입니다. :D
감사합니다.

좋아요 1