应用程序未正确配置以使用谷歌游戏服务。

18

我正在使用BaseGameActivity类连接到Google Play游戏服务。问题在于身份验证不起作用。我花了几个小时在网上寻找解决方案,但没有找到任何有助于解决问题的东西。

当我启动BaseGameActivity时,在LogCat中得到以下输出:

03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
03-19 14:22:36.126: W/GameHelper(15312): **** This is usually caused by one of these reasons:
03-19 14:22:36.126: W/GameHelper(15312): **** (1) Your package name and certificate fingerprint do not match
03-19 14:22:36.126: W/GameHelper(15312): ****     the client ID you registered in Developer Console.
03-19 14:22:36.126: W/GameHelper(15312): **** (2) Your App ID was incorrectly entered.
03-19 14:22:36.126: W/GameHelper(15312): **** (3) Your game settings have not been published and you are 
03-19 14:22:36.126: W/GameHelper(15312): ****     trying to log in with an account that is not listed as
03-19 14:22:36.126: W/GameHelper(15312): ****     a test account.
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** To help you debug, here is the information about this app
03-19 14:22:36.126: W/GameHelper(15312): **** Package name         : *****
03-19 14:22:36.126: W/GameHelper(15312): **** Cert SHA1 fingerprint: *****
03-19 14:22:36.126: W/GameHelper(15312): **** App ID from          : *****
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** Check that the above information matches your setup in 
03-19 14:22:36.126: W/GameHelper(15312): **** Developer Console. Also, check that you're logging in with the
03-19 14:22:36.126: W/GameHelper(15312): **** right account (it should be listed in the Testers section if
03-19 14:22:36.126: W/GameHelper(15312): **** your project is not yet published).
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** For more information, refer to the troubleshooting guide:
03-19 14:22:36.126: W/GameHelper(15312): ****   http://developers.google.com/games/services/android/troubleshooting

我检查了十多次,包名、证书SHA1指纹和应用程序ID(我在这里打星号)确实与https:// console.developers.google.com /project/my-app-id/apiui/credential中给出的完全相同。

我还删除了那里提供的客户端ID并重新创建了它们。但是没有任何帮助。你能帮我吗?


你是使用调试密钥(默认)签署应用程序,还是使用生产密钥导出? - 323go
我尝试了两种方式,并在开发者控制台中为两个密钥创建了客户端ID。 - principal-ideal-domain
7个回答

10
在我的情况下,SHA1指纹不正确。
  1. 进入Google Play开发者控制台,找到您的游戏
  2. 点击左侧的“游戏详情”选项卡
  3. 向下滚动到“API控制台项目”,并点击您的“项目名称”
  4. 现在,在Google开发者控制台(不同的控制台)中,转到API管理器
  5. 点击凭据选项卡
  6. 在OAuth 2.0客户端ID下,单击您的项目名称
  7. 现在,您可以更改您的SHA1指纹和/或包名称(如果需要)。

在这里找到您的客户端ID和指纹:Google Dev.控制台 -> 选择您的应用程序 -> Play游戏服务 -> 配置 -> 在“Android”部分下,单击右侧的蓝色箭头。 - Farkas Antal

3

您在设备上登录的用户需要是一个有效的测试帐户。

检查设备上登录的用户是否配置为有效的测试用户。如果没有,则将您登录设备的电子邮件添加到Google Play游戏开发者控制台上的测试帐户中。


我的登录用户是测试账户,我已经发布了应用程序。因此这不可能是问题的原因。 - principal-ideal-domain

0

请确保使用正确的SHA1。在我的情况下,我在电脑上有两个不同的debug.keystore文件。

一个位于C:\User\myUser\.android,另一个位于我的android-sdk\.android目录中。

我使用的是Eclipse,在我的情况下,debug.keystore是从android-sdk目录中使用的。

如果您正在使用Eclipse,可以在Window/Preferences/Android/Build/中检查debug.keystore的位置。


0

0

当您从Eclipse安装和运行游戏/应用程序时,它将无法登录并连接到Google游戏服务。请按照以下说明操作:
i. 您必须首先导出游戏/应用程序(在导出之前构建项目) ii. 然后将app.apk文件上传到设备 iii. 安装并运行游戏/应用程序,您将看到Google登录窗口。


0

以上的方法都对我没用。

如果您的GoogleSignInOptions无效,就会出现此错误,这是我的问题所在。

例如:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).
        requestServerAuthCode("AN INVALID CLIENT ID").
        build();

也会返回相同的错误。


0
只是为了其他人来到这里...对于我正在测试的未发布的应用程序,我还必须确保我用来连接我的设备上的Play Games的用户是在Google Cloud控制台>API和服务>OAuth同意屏幕>测试用户部分注册的测试者。

https://console.cloud.google.com/apis/credentials/consent


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接