Installing Google play service to Libgdx game

372 views Asked by At

when Im trying to add the Google play service to my Libgdx game that errors shows to me, I have no Idea from where to start.

any help?

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

when I remove this.googleServices.signIn(); the game start normally.

public class FFeather extends Game {
public  IGoogleServices googleServices;

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

}
....

the main android launcher:

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

The interface IGoogleServices which I think the error related to.

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

There are 0 answers