繁体   English   中英

Google Play游戏服务崩溃LibGDX游戏

[英]Google Play Games Service crash LibGDX Game

我尝试在我的LibGDX游戏中实现Google Play游戏服务器。 如果我开始我的游戏,它的工作时间是10秒,但是在这10秒之后,我的游戏崩溃了,我不知道为什么。 希望您能提供帮助。

这是代码

import android.os.Bundle;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
import com.google.android.*;
import com.randomsoftwareindustries.bubbleburster.bubbleburster;

public class AndroidLauncher extends AndroidApplication implements GameHelper.GameHelperListener{

GameHelper gameHelper;

@Override
protected void onCreate (Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useAccelerometer = false;
    config.useCompass = false;
    config.useWakelock = true;
    gameHelper = new GameHelper(this,GameHelper.CLIENT_ALL);
    gameHelper.enableDebugLog(true);
    initialize(new LIBGDXGAME(), config);
    gameHelper.setup(this);

}

@Override
public void onStart() {
    super.onStart();
    gameHelper.onStart(this);
}

@Override
public void onStop() {
    super.onStop();
    gameHelper.onStop();
}

@Override
public void onSignInFailed() {
    // TODO Auto-generated method stub
    System.out.println("Sign in failed");
}

@Override
public void onSignInSucceeded() {
    // TODO Auto-generated method stub
    System.out.println("Sign in succeeded");
}

}

尝试在onCreate中使用以下代码:

if (gameHelper == null) {
        gameHelper = new GameHelper(this, GameHelper.CLIENT_ALL); //maybie CLIENT_GAMES?
        gameHelper.enableDebugLog(true);
    }
    gameHelper.setup(this);

    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new LIBGDXGAME(this), config)

还要检查我的问题和答案。 也许您会发现一些有用的东西: 链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM