在谷歌发行游戏服务号(失败的第一次尝试,成功的第二个)

问题描述:

目前想我的游戏(使用libgdx)连接到谷歌游戏服务,使排行榜/成就等,并看到了一些奇怪的行为。

Currently trying to connect my game (that uses libgdx) to Google Game Services to enable leaderboard/achievements etc and seeing some strange behaviour.

问题

当我第一次点按登录,它显示的对话框选择你的谷歌账户,然后打服务许可界对话,那么大的负载循环。一段时间后,它会显示与下面的错误与谷歌Play业务的未知问题的对话

When I first tap on "Sign in", it displays the dialog to choose your google account, then play services permission circles dialog, then the big loading circle. After a while, it displays a dialog with the following error Unknown issue with Google Play services

如果我点击确定关闭那些错误对话框,然后点按登录按钮,再次,我立刻获得成功登录。在此之后,我可以看到排行榜等。

If I tap 'Ok' to dismiss that error dialog, then tap on the "Sign in" button again, I immediately get successfully logged in. After this, I can see the leaderboard etc.

详细信息

错误日志中我看到:

...
D: GameHelper: onActivityResult: req=RC_RESOLVE, resp=9001
D: GameHelper: onAR: responseCode=9001, so giving up.
D: GameHelper: killConnections: killing connections.
D: GameHelper: killConnections: all clients disconnected.
D: GameHelper: State change CONNECTING -> DISCONNECTED
D: GameHelper: Making error dialog for failure: SignInFailureReason(serviceErrorCode:SIGN_IN_REQUIRED(4),activityResultCode:9001)
D: GameHelper: Showing error dialog.
D: GameHelper: Notifying LISTENER of sign-in FAILURE (error)
I: ----- Sign in failed :( -----
///// Tap the 'sign in' button again ///////
I: ----- Begin sign in process... -----
D: GameHelper: Starting USER-INITIATED sign-in flow.
D: GameHelper: isGooglePlayServicesAvailable returned 0
D: GameHelper: beginUserInitiatedSignIn: starting new sign-in flow.
D: GameHelper: Starting connections.
D: GameHelper: State change DISCONNECTED -> CONNECTING
D: GameHelper: connectNextClient: requested clients: 1, connected clients: 0
D: GameHelper: Pending clients: 1
D: GameHelper: Connecting GamesClient.
D: GameHelper: onConnected: connected! client=1
D: GameHelper: Connected clients updated to: 1
D: GameHelper: connectNextClient: requested clients: 1, connected clients: 1
D: GameHelper: Pending clients: 0
D: GameHelper: All clients now connected. Sign-in successful!
D: GameHelper: All requested clients connected. Sign-in succeeded!
D: GameHelper: State change CONNECTING -> CONNECTED
D: GameHelper: Notifying LISTENER of sign-in SUCCESS
I: ----- Sign in success! -----
D: GameHelper: onActivityResult: req=3, resp=3
D: GameHelper: onActivityResult: request code not meant for us. Ignoring.
...

由于我使用libgdx,我不会延长 BaseGameActivity 相反,我创建一个 GameHelper 手动和使用代替

Since I'm using libgdx, I'm not extending BaseGameActivity instead, I'm creating a GameHelper manually and using that instead

// in @Override onCreate:
mGameHelper = new GameHelper(this);                
mGameHelper.setup(this, GameHelper.CLIENT_GAMES);    
mGamesClient = mGameHelper.getGamesClient();       

// in @Override onStart:
mGameHelper.onStart(this);

// then, for the sign in button, using it:
mGameHelper.beginUserInitiatedSignIn();

额外的信息

我也看到在日志中的以下内容:

I'm also seeing the following in the logs:

E: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

但是,不知道这是否是相关的,因为从我读过,这似乎与地图/ GPS /位置。不使用地图,我能够登录,所以不知道这个错误是相关的还是不(虽然这听起来很糟糕!)

更新/编辑的:经过测试,这个错误是由AdMob的(我已经与谷歌服务的综合性)引起的。虽然错误听起来很糟糕,禁止AdMob的(没有更多的错误)的奇怪的行为仍然是相同的。

Update/Edit: After testing, this error was caused by AdMob (which I've integrated with the google services). Though the error sounds bad, disabling AdMob (no more error) the strange behaviour is still the same.

我觉得下面是有趣的错误日志,虽然还没有多少运气谷歌搜索此错误:

I think the below is the interesting error log, though haven't had much luck googling this error:

E/dalvikvm( 2618): Could not find class 'android.app.AppOpsManager', referenced from method axo.a

编辑2 :更多的发现
我得到即使我不通过工作流的整个标志做了同样的错误对话框。

EDIT 2: More findings!
I get the same error dialog even if I don't go through the entire sign in workflow.

  • 点击登录
  • 查看帐户列表登录
  • 点击取消
  • 查看警告对话框的标题/消息:与谷歌未知的问题上发挥服务
  • Tap 'Sign in'
  • See list of accounts to log in to
  • Tap 'Cancel'
  • See alert dialog with the title/message: Unknown issue with Google Play services

任何帮助将是巨大的!

请注意:

  • 在这可以稳定地再生 - 注销,并在日志中的按钮两个水龙头给上述
  • 所描述的行为
  • 在确信我打电话 onActivityResult 在Google玩游戏服务:奇怪的符号的行为
  • 通过教程去,并成立了示例应用程序(A型号码) - 和一切工作
  • This can be consistently reproduced - log out, and two taps on the log in button gives the behaviour as described above
  • Made sure I am calling onActivityResult as suggested in Google Play Game Services: strange sign in behavior
  • Went through the tutorial and set up the sample app (Type A Number) - and everything worked.

你激活激活API在此链接: https://console.developers.google.com/project

Did you activate activate the api at this link: https://console.developers.google.com/project ?