Android Google sigin获得ApiException“ 12500”

时间:2019-01-15 12:33:31

标签: android google-signin

在我的Android应用中,我必须实现Google SigIn Option,但是Debug Apk可以正常工作,并且得到了预期的结果。在SignedApk(已发布的应用)中,出现 siginError:'12500'

我尝试了这个Google Sign In error 12500

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .requestProfile()
            .requestScopes(new Scope(Scopes.PLUS_ME))
            .build();
    mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
    signInButton = findViewById(R.id.signInButtonGoogle);
    signInButton.setSize(SignInButton.SIZE_STANDARD);
    setGooglePlusButtonText(signInButton, "Continue with Google");
    signInButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (new AppPermissions(LoginActivity.this).checkPermission()) {
                signIn();
            }
        }
    });



@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        // The Task returned from this call is always completed, no need to attach
        // a listener.
        Task<GoogleSignInAccount> completedTask = GoogleSignIn.getSignedInAccountFromIntent(data);
        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);
        }

    }

}

1 个答案:

答案 0 :(得分:1)

生成释放密钥的SHA指纹并将SHAH密钥添加到Google项目