0

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.

Opal
  • 81,889
  • 28
  • 189
  • 210
Andrei
  • 1,183
  • 2
  • 19
  • 40
  • possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Nathan Tuggy May 17 '15 at 02:48
  • 2
    well I know how to fix a Null Exception in my own code. The issue here is that is is directly inside Google Play Services which I do not understand. – Andrei May 18 '15 at 12:20
  • This is happening to me as well. I'm not using Andengine, however. Just basic Google Play Services. Maybe they broke something in the latest update? I submitted an error report, regardless. – shan Jun 03 '15 at 04:42
  • Actually, I just saw a different post and checked my leaderboard ID that I was using in my code and it was wrong. It works fine now, no Google Play Services crash. Maybe check if your leaderboard ID is correct? Other than that there's not much you can do but wait for a play games update that will fix the crash. – shan Jun 03 '15 at 04:44
  • Thank you for your advice, but I've tried reviewing the IDs many times, I do have the correct IDs :( – Andrei Jun 04 '15 at 12:25

0 Answers0