加载GPGS排行榜打破App

时间:2014-12-26 18:33:20

标签: java android libgdx google-play-games

我正在使用Libgdx。我正在尝试使用Google Play游戏服务为我的游戏添加排行榜。我有一个ActionResolver接口与抽象方法。 submitscoreGPGS()方法根本不打破应用程序。但是当我添加getLeaderboard()时,游戏甚至不会加载到我的Android模拟器中。它只是说Platformer已停止工作了。

这是检测游戏是否已经击中排行榜按钮的内容。 Touched.inBounds只是我制作的一种实用方法。

    if(Gdx.input.justTouched()) {

        //some code removed

        //if I comment this if statement the app will run just fine
        if(Touched.inBounds(leaderboardButton.bounds, camera) && paused) {

            game.actionResolver.getLeaderboardGPGS();

        }

    }

这是我的AndroidLauncher类

public class AndroidLauncher extends AndroidApplication implements ActionResolver {

GoogleApiClient mGoogleApiClient;
int REQUEST_LEADERBOARD = 100;

@Override
protected void onCreate (Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new Platformer(this), config);

}

@Override
public void submitScoreGPGS(int score) {

    Games.Leaderboards.submitScore(mGoogleApiClient, getString(R.string.leaderboard_id), score);

}

@Override
public void getLeaderboardGPGS() {

    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, getString(R.string.leaderboard_id)), REQUEST_LEADERBOARD);

}
}

Logcat错误:

12-26 13:46:23.120: E/AndroidRuntime(1203): FATAL EXCEPTION: GLThread 84
12-26 13:46:23.120: E/AndroidRuntime(1203): Process: com.JrodManU.Platformer.android, PID: 1203
12-26 13:46:23.120: E/AndroidRuntime(1203): java.lang.IllegalArgumentException: GoogleApiClient parameter is required.
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.google.android.gms.internal.fq.b(Unknown Source)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.google.android.gms.games.Games.c(Unknown Source)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.google.android.gms.games.internal.api.LeaderboardsImpl.submitScore(Unknown Source)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.google.android.gms.games.internal.api.LeaderboardsImpl.submitScore(Unknown Source)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.JrodManU.Platformer.android.AndroidLauncher.submitScoreGPGS(AndroidLauncher.java:41)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.JrodManU.Platformer.GameScreen.logicUpdate(GameScreen.java:109)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.JrodManU.Platformer.GameScreen.render(GameScreen.java:55)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.badlogic.gdx.Game.render(Game.java:46)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:416)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
12-26 13:46:23.120: E/AndroidRuntime(1203):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
12-26 13:46:27.735: E/AndroidGraphics(1203): waiting for pause synchronization took too long; assuming deadlock and killing

0 个答案:

没有答案