com.google.android.gms.common.api.ApiException:12500

时间:2019-07-27 04:32:06

标签: android firebase google-signin

我在firebase中设置了一个项目,并使用SHA1配置了我的android应用,然后按照说明设置了Google-SignIn,但它总是抛出异常,并且在onActivity结果中我得到resultCode 0。

我尝试通过更改SHA1,但它不起作用。

这是我的代码

GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
        Intent signInIntent = mGoogleSignInClient.getSignInIntent();
        startActivityForResult(signInIntent, 1000);

@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1000) {
            try {
                // Google Sign In was successful, authenticate with Firebase
                Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
                GoogleSignInAccount account = task.getResult(ApiException.class);
                firebaseAuthWithGoogle(account);

            } catch (ApiException e) {
                e.printStackTrace();

            }
        }
    }

例外:

W/System.err: com.google.android.gms.common.api.ApiException: 12500: 
W/System.err:     at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
        at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
        at thugdroid.passman.MainActivity.onActivityResult(MainActivity.java:41)
        at android.app.Activity.dispatchActivityResult(Activity.java:6956)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4251)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4298)
        at android.app.ActivityThread.-wrap20(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:203)
        at android.app.ActivityThread.main(ActivityThread.java:6339)
        at java.lang.reflect.Method.invoke(Native Method)

0 个答案:

没有答案