使用google`gms.auth.UserRecoverableAuthException:BadAuthentication`exception android登录

使用google`gms.auth.UserRecoverableAuthException:BadAuthentication`exception android登录,android,google-signin,Android,Google Signin,我正在尝试使用google按钮将登录添加到我的应用程序中。我遵循谷歌文档。但是给我的结果总是null。因此,我无法访问result.issucess()。它给出com.google.android.gms.auth.UserRecoverableAuthException:BadAuthentication异常。我正确地遵循了所有步骤 这是登录意图 Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClien

我正在尝试使用google按钮将登录添加到我的应用程序中。我遵循谷歌文档。但是给我的结果总是
null
。因此,我无法访问
result.issucess()
。它给出
com.google.android.gms.auth.UserRecoverableAuthException:BadAuthentication
异常。我正确地遵循了所有步骤

这是登录意图

Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
            startActivityForResult(signInIntent, 1);
这就是我收到结果的地方

if (requestCode == 1) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);
    }
handleSignInResult()方法

谷歌登录选项

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .build();

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();

我找不到原因。如果您需要了解任何信息,请发表评论。非常感谢您的帮助。多谢各位

我不知道你调用了什么,所以你得到了UserRecoverableAuthException

但如果您得到result.getStatus().getStatusCode()==8(内部错误),则可能缺少开发人员控制台注册


阅读有关异常的信息,使用
getIntent()
startActivityForResult(Intent)
@EugenPechanec谢谢您的回复。我的状态代码是
INTERNAL\u ERROR
。然后你需要在谷歌开发控制台中添加你的应用程序。使用正确的包名和密钥哈希。并启用singin API。共享您定义的GoogleSignionOptions对象和GoogleAPI客户端对象所在的代码。这可能是例外的原因。谢谢你的回答。我再次下载了android studio,并将我的sha1更改为新下载的android studio密钥库文件的密钥库文件。成功了。
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .build();

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();