我已经测试过 ButtonClicker 2000 示例并且效果很好。现在我正在尝试将 Google Games Services 实施到另一个游戏中,但它给出了一些错误:
06-06 12:30:46.353: D/BaseGameActivity(7982): isGooglePlayServicesAvailable returned 0
06-06 12:30:46.353: D/BaseGameActivity(7982): beginUserInitiatedSignIn: starting new sign-in flow.
06-06 12:30:46.416: D/BaseGameActivity(7982): Connecting GamesClient.
06-06 12:30:46.424: D/BaseGameActivity(7982): onStart.
06-06 12:30:46.424: D/BaseGameActivity(7982): onStart: connecting clients.
06-06 12:30:46.424: D/BaseGameActivity(7982): Connecting GamesClient.
06-06 12:30:46.424: E/GmsClient(7982): Calling connect() while still connected, missing disconnect().
06-06 12:30:46.713: D/BaseGameActivity(7982): onConnectionFailed: result 4
06-06 12:30:46.713: D/BaseGameActivity(7982): onConnectionFailed: since user initiated sign-in, trying to resolve problem.
06-06 12:30:46.713: D/BaseGameActivity(7982): resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41692200: android.os.BinderProxy@416921a0}}
06-06 12:30:46.713: D/BaseGameActivity(7982): result has resolution. Starting it.
06-06 12:30:46.900: D/BaseGameActivity(7982): onActivityResult, req 9001 response 0
06-06 12:30:46.900: D/BaseGameActivity(7982): responseCode != RESULT_OK, so not reconnecting.
06-06 12:30:46.900: D/BaseGameActivity(7982): giveUp: giving up on connection. Status code: 4
06-06 12:30:46.900: D/BaseGameActivity(7982): Making error dialog for error: 4
com.google.android.gms 记录以下错误:
E/SignInActivity(7432): SignInActivity must be started with startActivityForResult
我做了什么:
- 我已经正确配置了开发者控制台端。SHA1 是正确的(匹配 androiddebug 密钥库)。
- 在 API 控制台中,一切看起来都很好。
- 我扩展了 GameBaseActivity 并实现了请求的接口。
- 我在值文件夹中有一个 ids.xml,它与开发人员控制台中的那个相匹配。
- 我已经覆盖了请求的方法,包括 onActivityResult()
清单也可以,它包含请求的元数据。
这是我用来登录 onCreate 的代码:
setSignInMessages("SIGNING IN", "SIGNING OUT"); beginUserInitiatedSignIn();
在测试示例 Button Clicker 2000 时,我也遇到了未知错误,并修复了它正确配置仪表板的问题。当前的游戏仪表板也配置正确,所以我真的不知道发生了什么。我错过了什么?
编辑:
- 我还尝试解开 BaseGameActivity 并直接在我的主 Activity 中实现 GameHelper。
- 我尝试发布应用游戏设置(因为该游戏已在 Play Store 上发布)。将另一个应用程序与我的发布签名 SHA1 密钥相关联。设置为主应用程序进行安装。仍然没有运气。