I am working on a game using AndEngine
(not sure if it could be related).
Basically I have an Activity
which implements AndEngine
and Google Play Services.
Both work well together and I can sign in.
But, I've been trying to make Leaderboards
work. Submitting score works, but once I try to show the leaderboard using this:
SceneManager.activity.startActivityForResult(Games.Leaderboards.getLeaderboardIntent(SceneManager.gameHelper.getApiClient(), leaderBoard_Id), 1);
I am getting this:
java.lang.NullPointerException: Attempt to invoke interface method 'com.google.android.gms.games.Game com.google.android.gms.games.leaderboard.Leader board.getGame()' on a null object reference at com.google.android.gms.games.ui.common.leaderb oards.LeaderboardScoreFrag ment.onResult(Leaderb oardScoreFrag ment.java:63) at com.google.android.gms.common.api.AbstractPend i ng Result SCal I backHand ler. hand leMessage(AbstractPend i ng R esult.java:300) at android.os.Handler.dispatchMessage(Handler.java: 102) a arm :01..0s. ooper. oop ooper.java: at android.app.ActivityThread.main(ActivityThreadjava :5321) at java.lang.reflectMethod.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java: 372) at com.android.internal.os.Zygotelnit SMethodAndArgsCaller.run(Zygotelnitjava:1016) at com.android.internaLos.Zygotelnitmain(Zygotelnitj
Sorry about the block of text, I couldn't copy paste.
Does someone have any idea what could be happening please? I've been spending a lot of time on this but cannot figure it out.