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)
同时检查我的问题和答案。也许你会发现一些有用的东西:
link
我尝试在我的 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)
同时检查我的问题和答案。也许你会发现一些有用的东西: link