应用程序未正确配置以使用Google Play服务。

3

我已经卡在这个问题上几个小时了,但似乎一点进展也没有。

我有一个简单的游戏,想要将其与Google Play服务整合。我想添加一个排行榜和一些成就。

这是我所做的:

  1. MainActivity extends BaseGameActivity, and I've imported the BaseGameUtils project and the google-play-services_lib projects. I've added them both as Library projects of the game.

  2. I've created two client IDs in Google Developers console for both my product and my debug keys.

  3. I added my email as a tester in the Google Play Developer console, in the Game Services section and for this app.

  4. When I run the app, I can see the Google Play services dialog, and I can select an account and I can see the permissions dialog. However when I click Ok I get the following message:

    The application is incorrectly configured. Check that the package name and signing certificate match the client ID created in Developer Console. Also, if the application is not yet published, check that the account you are trying to sign in with is listed as a tester account. See logs for more information.
    
日志内容如下:
03-14 16:45:08.023: W/GameHelper(3839): **** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
03-14 16:45:08.023: W/GameHelper(3839): **** This is usually caused by one of these reasons:
03-14 16:45:08.023: W/GameHelper(3839): **** (1) Your package name and certificate fingerprint do not match
03-14 16:45:08.023: W/GameHelper(3839): ****     the client ID you registered in Developer Console.
03-14 16:45:08.023: W/GameHelper(3839): **** (2) Your App ID was incorrectly entered.
03-14 16:45:08.023: W/GameHelper(3839): **** (3) Your game settings have not been published and you are 
03-14 16:45:08.023: W/GameHelper(3839): ****     trying to log in with an account that is not listed as
03-14 16:45:08.023: W/GameHelper(3839): ****     a test account.
03-14 16:45:08.023: W/GameHelper(3839): ****
03-14 16:45:08.023: W/GameHelper(3839): **** To help you debug, here is the information about this app
03-14 16:45:08.023: W/GameHelper(3839): **** Package name         : com.blabla.myapp
03-14 16:45:08.031: W/GameHelper(3839): **** Cert SHA1 fingerprint: A9:5C:17:57:0D:74:1A:11:FF:8C:03:B9:7C:8D:49:12:9F:D6:2A:2C
03-14 16:45:08.031: W/GameHelper(3839): **** App ID from          : 71440642016
03-14 16:45:08.031: W/GameHelper(3839): ****
03-14 16:45:08.031: W/GameHelper(3839): **** Check that the above information matches your setup in 
03-14 16:45:08.031: W/GameHelper(3839): **** Developer Console. Also, check that you're logging in with the
03-14 16:45:08.031: W/GameHelper(3839): **** right account (it should be listed in the Testers section if
03-14 16:45:08.031: W/GameHelper(3839): **** your project is not yet published).
03-14 16:45:08.031: W/GameHelper(3839): ****
03-14 16:45:08.031: W/GameHelper(3839): **** For more information, refer to the troubleshooting guide:
03-14 16:45:08.031: W/GameHelper(3839): ****   http://developers.google.com/games/services/android/troubleshooting

日志中显示的所有数据与应用程序中完全相同。我甚至尝试将日志中的数据复制/粘贴以创建新的客户端ID,但仍然出现相同的错误。

我还重新阅读了故障排除指南(位于http://developers.google.com/games/services/android/troubleshooting),一切似乎都没问题。

日志中还多次出现以下错误消息。我不确定它是否有任何关系。我已经搜索了谷歌,也无法修复:

03-14 16:45:01.960: E/GooglePlayServicesUtil(3839): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

更新测试用户可能需要几个小时吗?自从我添加了自己以来,已经过去了至少3到4个小时。

有什么想法吗?我已经没有任何想法了。

唯一相关的代码在我的onCreate()方法中:

    // Google Play Services
    GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addApi(Games.API)
    .addScope(Games.SCOPE_GAMES)
    .build();


    mGoogleApiClient.connect();

我也尝试运行了示例应用程序(Type-a-number challenge),在设置好一切后,我仍然遇到同样的错误,即使这些值与 Google Dev Console 中报告的值也相似。谢谢!

你尝试过在你的设备上更新Google服务吗?(或者,也许更好的方法是重新安装它?) - xav
1
没有,但如果那是错误,我不能指望用户仅为了我的程序更新谷歌服务 :) - zundi
你解决了吗? - GmloMalo
@GmloMalo 老实说我不记得了,那是一段时间之前的事了。 - zundi
3个回答

1
我有同样的问题。我按照这个指南操作。

https://developers.google.com/games/services/android/troubleshooting

尽管在这个指南中修改了每个主题(如果您的配置中有错误,则这是必要的),但问题仍然存在。
为了解决它,我清除了关联的应用程序并重新创建了它。 但是,我没有通过Google开发者控制台创建它,而是通过Google Play控制台创建它。因此,对于每个SH1代码,我创建了新的关联应用程序,然后问题得到解决。

1
我有同样的问题。你需要检查开发者控制台(API)中创建的SHA1和为文件构建APK时的SHA1 [最后一步],并确保两者完全相同。如果正确插入了应用程序ID,则它们将是相同的。

0
包ID应该与清单XML文件中提到的主要Android应用程序包相匹配。它必须是主要应用程序包名称,而不是库包名称。

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