Google Sign In - ApiException 12501 when dismissing the sign in dialog

Better check google sample and handle exception like this

private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
        try {
            GoogleSignInAccount account = completedTask.getResult(ApiException.class);

            // Signed in successfully, show authenticated UI.
            updateUI(account);
        } catch (ApiException e) {
            // The ApiException status code indicates the detailed failure reason.
            // Please refer to the GoogleSignInStatusCodes class reference for more information.
            Log.w(TAG, "signInResult:failed code=" + e.getStatusCode());
            updateUI(null);
        }
    }

Such way you will not lose sign in status codes and can check for common status code.


Can you try this and let me know what happens:

if (requestCode == RC_SIGN_IN) {
        val task = GoogleSignIn.getSignedInAccountFromIntent(data)
        try {
            val account = task.result(ApiException::class.java)
            firebaseAuthWithGoogle(account)
        } catch (e: ApiException) {
            Log.w("TAG", "signInResult:failed code=" + e.getStatusCode());
        }
    }

Please, tell me what you get when Logging this.

Also it would be great if you can also upload whole code you wrote in SignIn Activity and also the google-services.json file so that i can debug the issue.

EDIT Add this

if (resultCode == Activity.RESULT_OK)

after requestCode == RC_SIGN_IN