【发布时间】:2017-08-03 23:38:35
【问题描述】:
我正在尝试在我的项目中添加排行榜和成就系统大约 3 天...
我可以登录我的应用,但是当我尝试打开排行榜时,它会说:
E/UncaughtException: java.lang.IllegalStateException: GoogleApiClient is not configured to use the Games Api. Pass Games.API into GoogleApiClient.Builder#addApi() to use this feature.
at com.google.android.gms.common.internal.zzac.zza(Unknown Source)
at com.google.android.gms.games.Games.zzc(Unknown Source)
at com.google.android.gms.games.Games.zzb(Unknown Source)
at com.google.android.gms.games.Games.zzi(Unknown Source)
at com.google.android.gms.games.internal.api.LeaderboardsImpl.getLeaderboardIntent(Unknown Source)
at com.google.android.gms.games.internal.api.LeaderboardsImpl.getLeaderboardIntent(Unknown Source)
at com.google.android.gms.games.internal.api.LeaderboardsImpl.getLeaderboardIntent(Unknown Source)
at tr.com.blogspot.etkinlikhavuzu.benimilkogretmenim.Ilksayfa.onClick(Ilksayfa.java:309)
at android.view.View.performClick(View.java:5702)
at android.widget.TextView.performClick(TextView.java:10888)
at android.view.View$PerformClick.run(View.java:22541)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
我该如何解决这个问题?
我写了这段代码:
case R.id.Enbasarili:
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient,
getResources().getString(R.string.leaderboard_en_cok_70_ve_ustu_basari_gosterenler)), RC_UNUSED);
break;
感谢您的帮助...
【问题讨论】:
-
好吧,
GoogleApiClient is not configured to use the Games Api.你Pass Games.API into GoogleApiClient.Builder#addApi() to use this feature了吗? -
我想我没有。我不明白该怎么做。
-
也许你应该去阅读一些文档,比如this。
-
我真的在网上搜索了大约一天的时间,但搜索错误的位置。无论如何谢谢你。我想我明白了。
标签: android android-studio google-api google-play-games google-api-client