1

This question has been asked multiple times, yet no answer have worked for me.

Here's some insight :

  • I am using BaseGameUtils

  • In my logs I am getting You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE

  • In my manifest file I have inside the application item I have <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id"

  • I have added my email as a tester account

  • The game is a draft on the google console API

  • I have added INTERNET AND ACCESS_NETWORK_STATE permissions

  • I have generated credentials using keytool on the debug.keystore file and copied to SHA-1 result to credentials in the Google Console API

  • I have deleted debug.keystore to regenerate a SHA-1 key as shown here

My manifest file looks like this :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.martenscedric.hexpert"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/GdxTheme" >
        <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
        <activity
            android:name="com.martenscedric.hexpert.AndroidLauncher"
            android:label="@string/app_name" 
            android:screenOrientation="landscape"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

The implementation looks like this :

private GameHelper gameHelper;
@Override
protected void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
    gameHelper.enableDebugLog(false);

    GameHelper.GameHelperListener gameHelperListener = new GameHelper.GameHelperListener() {
        @Override
        public void onSignInFailed() {

        }

        @Override
        public void onSignInSucceeded() {

        }
    };

    gameHelper.setup(gameHelperListener);

    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new Hexpert(this), config);
}


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

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

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    gameHelper.onActivityResult(requestCode, resultCode, data);
}

@Override
public void signIn() {
    try
    {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                gameHelper.beginUserInitiatedSignIn();
            }
        });
    }catch (Exception e)
    {
        e.printStackTrace();
    }
}

@Override
public void signOut() {
    try
    {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                gameHelper.signOut();
            }
        });
    }catch (Exception e)
    {
        e.printStackTrace();
    }
}
Community
  • 1
  • 1
Cedric Martens
  • 1,139
  • 10
  • 23
  • Is it your signed apk with your own `keystore` ? – Abhishek Aryan May 19 '17 at 04:59
  • Possible duplicate of [Failed to sign in. Please check your network connection and try again](http://stackoverflow.com/questions/26804929/failed-to-sign-in-please-check-your-network-connection-and-try-again) – Winter May 19 '17 at 15:24
  • I believe it is, I did the keytool command in the debug.keystore and with the default password "android" and then copied the SHA-1 result to the Google Console API credentials. – Cedric Martens May 19 '17 at 19:10

1 Answers1

0

Turned out it was a refactoring problem. When I refactored the project's name from A to B, I did change the manifest to com.me.B, but not in Gradle.

Cedric Martens
  • 1,139
  • 10
  • 23