接入google game 登陆时遇到好多坑,以下是我遇到的一些问题
坑1、应用启动初始化时,显示链接失败,错误如下
onConnectionFailed : ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{5550a7d: android.os.BinderProxy@815bd72}, message=null}
坑2、登陆时反馈4的错误码
ConnectionResult.getErrorCode() = 4
坑3、返回错误码 10002
Returning non-OK result: 10002
坑4、需要在谷歌api 后台设置为可用 https://console.developers.google.com/apis/api/games.googleapis.com/overview?project=
log:Access Not Configured. Google Play Game Services API has not been used in project 828200630xxx before or it is disabled
坑5
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
出现以上问题需耐下心来慢慢自检
1、谷歌后台的game service 是否发布,game service中的项目是否关联到发布的项目
2、应用是否发布(alpha版),并且成为测试人员 https://play.google.com/apps/testing/packagename
3、成为测试人员和手机登陆的账号确保是同一个账号
4、签名是否一致
5、version code 确保比线上的小
6、所需要的权限是否在配置文件中添加和动态请求中添加 主要为getaccount 权限
7、game service 是否设置为可用 https://console.developers.google.com/apis/api/games.googleapis.com/overview?project=
8、credentials 栏中创建好资额证书和 oAuth consent screen
library中 Google Play Game Services and Google Play Game Management and Drive API 统统设置为Enable
https://console.developers.google.com/apis/dashboard?project=