安装Google Play服务到Libgdx游戏

时间:2015-06-07 21:25:16

标签: java android libgdx google-play-services

当我试图将Google Play服务添加到我的Libgdx游戏时,错误显示给我,我不知道从哪里开始。

任何帮助?

06-08 00:04:29.626: I/System.out(3668): debugger has settled (1381)
06-08 00:04:29.774: D/dalvikvm(3668): Trying to load lib /data/app-lib/com.alnassre.ffeather.android-1/libgdx.so 0x41ef5348
06-08 00:04:29.782: D/dalvikvm(3668): Added shared lib /data/app-lib/com.alnassre.ffeather.android-1/libgdx.so 0x41ef5348
06-08 00:04:29.782: D/dalvikvm(3668): No JNI_OnLoad found in /data/app-lib/com.alnassre.ffeather.android-1/libgdx.so 0x41ef5348, skipping init
06-08 00:04:30.962: D/dalvikvm(3668): threadid=1: still suspended after undo (sc=1 dc=1)
06-08 00:04:31.532: D/GameHelper(3668): GameHelper: Debug log enabled.
06-08 00:04:32.227: D/GameHelper(3668): GameHelper: Setup: requested clients: 1
06-08 00:04:32.306: W/PopupManager(3668): You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
06-08 00:04:36.837: D/AndroidRuntime(3668): Shutting down VM
06-08 00:04:36.837: W/dalvikvm(3668): threadid=1: thread exiting with uncaught exception (group=0x41646700)
06-08 00:04:36.868: E/AndroidRuntime(3668): FATAL EXCEPTION: main
06-08 00:04:36.868: E/AndroidRuntime(3668): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alnassre.ffeather.android/com.alnassre.ffeather.android.AndroidLauncher}: java.lang.NullPointerException

当我移除 this.googleServices.signIn();游戏正常启动时。

public class FFeather extends Game {
public  IGoogleServices googleServices;

public FFeather(IGoogleServices googleServices)
{
super();
this.googleServices = googleServices;.
this.googleServices.signIn();

}
....

主要的android启动器:

public class AndroidLauncher extends AndroidApplication implements GameHelperListener,IGoogleServices {
    private GameHelper _gameHelper;
    private final static int REQUEST_CODE_UNUSED = 9202;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Create the GameHelper.
        _gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
        _gameHelper.enableDebugLog(true);

        GameHelperListener gameHelperListener = new GameHelper.GameHelperListener() {
            @Override
            public void onSignInSucceeded() {
                Gdx.app.log("AndroidLauncher", "start: onSignInSucceeded()");
            }

            @Override
            public void onSignInFailed() {
                Gdx.app.log("AndroidLauncher", "start: onSignInFailed()");
            }
        };

        _gameHelper.setup(gameHelperListener);

        // main code
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        initialize(new FFeather(this), config);

    } 

    @Override
    public void signIn() {
        Gdx.app.log("AndroidLauncher", "start: signIn()");
    }
    ....

界面IGoogleServices ,我认为错误与相关。

public interface IGoogleServices {
    public void signIn();
    public void signOut();
    public void rateGame();
    public void submitScore(long score);
    public void showScores();
    public boolean isSignedIn();
}

0 个答案:

没有答案