Google登录Android应用DEVELOPER_ERROR com.google.android.gms.common.api.ApiException:10:

问题描述 投票:0回答:1

1。运行signingReport,获取sha1

 A3:8C:26:5D:0A:42:5A:C4:F0:C0:4A:FE:AA:8D:31:F7:76:7C:A1:39

Variant: debug
Config: debug
Store: C:\Users\gysgogo\.android\debug.keystore
Alias: AndroidDebugKey
MD5: 0B:63:BA:DC:B8:8E:58:D4:7A:34:BE:C8:39:96:EE:01
SHA1: A3:8C:26:5D:0A:42:5A:C4:F0:C0:4A:FE:AA:8D:31:F7:76:7C:A1:39
SHA-256: 92:81:AD:4D:56:BA:62:6A:C8:0E:83:EF:F4:0E:A2:04:DE:BD:AD:21:DE:FB:41:18:FA:DA:CE:1B:66:22:BF:EC

2。使用sha1和程序包名称创建OAuth客户端ID

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.gysgogo.myproject">

enter image description here

3。获取客户ID:

 621243190890-auj4jgcmva200np43n104s2fmdvu2um7.apps.googleusercontent.com

enter image description here

4。添加代码:

GoogleSignInOptions gso = new GoogleSignInOptions.
     Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
     .requestEmail()
     .requestIdToken("621243190890-auj4jgcmva200np43n104s2fmdvu2um7.apps.googleusercontent.com")
     .build();
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(LoginActivity.this, gso);
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, 200);

5.onActivityResult

Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
GoogleSignInAccount account = null;
try {
   account = task.getResult(ApiException.class);
   String email = account.getEmail();
   String displayName = account.getDisplayName();
   String id = account.getId();
   xUri photoUrl = account.getPhotoUrl();
} catch (ApiException e) {
   e.printStackTrace();
}

6.got错误

DEVELOPER_ERROR com.google.android.gms.common.api.ApiException:10:

7。我在哪里错了?谢谢

android
1个回答
0
投票

我运行调试版本并使用发行版OAuth密钥时出现DEVELOPER_ERROR。有时它表示找不到有效密钥(没有密钥发送给google)。尝试发布版本

© www.soinside.com 2019 - 2024. All rights reserved.