无法获取排行榜 [英] Can't retrieve leaderboard

查看:129
本文介绍了无法获取排行榜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在游戏中使用排行榜.我在开发人员控制台中设置了游戏服务项目,构建了api客户端并将其连接.但是,当我尝试使用以下代码检索页首横幅时(我将实际ID替换为my_leaderboard_id):

I want to use leaderboards in my game. I set up game services project in developer's console, built api client and connected to it. But when I try to retrieve leaderboard with following code (I replaced actual id with my_leaderboard_id):

 startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, LEADERBOARD_ID), 100);

我收到以下错误:

05-18 17:25:04.330: E/Volley(1443): [149] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/games/v1/leaderboards/my_leaderboard_id?language=ru_RU
05-18 17:25:04.330: E/LeaderboardAgent(1443): Unable to retrieve leaderboard my_leaderboard_id
05-18 17:25:04.330: E/LeaderboardAgent(1443): No instance found for leaderboard my_leaderboard_id for SOCIAL and ALL_TIME

05-18 17:25:04.373: E/AndroidRuntime(13891): java.lang.NullPointerException: Attempt to invoke interface method 'com.google.android.gms.games.Game com.google.android.gms.games.leaderboard.Leaderboard.getGame()' on a null object reference

因此,无法获取页首横幅.但是似乎发布分数可以正常工作(至少LogCat中没有错误消息):

So, leaderboard cannot be retrieved. But it seems that posting score works fine (at least there are no error messages in LogCat):

Games.Leaderboards.submitScore(mGoogleApiClient, LEADERBOARD_ID, score);

还需要提及的是,我尚未发布游戏服务项目,因此它处于准备测试"状态.但是我的电子邮件在测试人员列表中,因此我认为一切都应该没问题.任何人都知道这里有什么问题吗?

It is also needed to be mentioned, that I haven't published game services project yet, so it is in "Ready to test" state. But my e-mail is in testers list, so I suppose everything should be fine with this. Anyone has a clue what can be wrong here?

推荐答案

那是我的错,我错误地使用了我的游戏服务项目ID而不是排行榜ID.现在可以了.

That was my fault, I used my game services project id instead of leaderboards id by mistake. Now it works.

这篇关于无法获取排行榜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆