作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
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 :
Gradle
(从右侧面板,你会看到Gradle Bar)任务
Android
signingReport
(你会得到SHA-1
和MD5
)<强>2。将您的 key 添加到您的 Firebase
项目:
进入项目设置
-> SHA证书指纹
-> 添加调试应用的SHA-1
键。
然后您可以在您的 Android 项目中更新您的 google-services.json
文件。
它对我有用。
关于android - 为什么我会收到 com.google.android.gms.common.api.ApiException : 10:?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47437678/
我是一名优秀的程序员,十分优秀!