gpt4 book ai didi

android - 为什么我会收到 com.google.android.gms.common.api.ApiException : 10:?

转载 作者:IT老高 更新时间:2023-10-28 21:50:49 31 4
gpt4 key购买 nike

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

// Signed in successfully, show authenticated UI.
System.out.println("google token ---> " + account.getIdToken());
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information about this error.
e.printStackTrace();
}
}

最佳答案

引用 documentation :

Certain Google Play services (such as Google Sign-in and App Invites)require you to provide the SHA-1 of your signing certificate so we cancreate an OAuth2 client and API key for your app.

如果您使用的是 Firebase 并尝试使用 debug app:

1.首先,获取您的 SHA-1 调试 key :

  1. 点击Gradle(从右侧面板,你会看到Gradle Bar)
  2. 点击任务
  3. 点击Android
  4. 双击signingReport(你会得到SHA-1MD5)

<强>2。将您的 key 添加到您的 Firebase 项目:

  1. 进入项目设置 -> SHA证书指纹 -> 添加调试应用的SHA-1键。

  2. 然后您可以在您的 Android 项目中更新您的 google-services.json 文件。

它对我有用。

关于android - 为什么我会收到 com.google.android.gms.common.api.ApiException : 10:?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47437678/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com