简体   繁体   English

Google Play游戏服务崩溃LibGDX游戏

[英]Google Play Games Service crash LibGDX Game

I try to implements the Google Play Games Server in my LibGDX Game. 我尝试在我的LibGDX游戏中实现Google Play游戏服务器。 If i start my Game it work's 10 Seconds but after this 10 Sek my Game crash and i don't know why. 如果我开始我的游戏,它的工作时间是10秒,但是在这10秒之后,我的游戏崩溃了,我不知道为什么。 I hope you can help. 希望您能提供帮助。

Here is the code 这是代码

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");
}

} }

try with this code in onCreate: 尝试在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)

also check my question and answer. 还要检查我的问题和答案。 Maybie you will find something usefull: link 也许您会发现一些有用的东西: 链接

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

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