title: failed to sign in . Please check your network connection ad try again , google play game services
body: <p>This might be a duplicate but i have tried everything available on internet to fix this but no luck so far , so asking again .
  I have implemented a game in libGDX and now using google play games in it , using BaseGameUtils lib and google api methods . but when i start game now i get below error</p>
  
  <blockquote>
    <p>failed to sign in . Please check your network connection ad try again , google play game services </p>
  </blockquote>
  
  <p>I have checked for all solutions provided in the below link but nothing worked </p>
  
  <p><a href="https://stackoverflow.com/questions/26804929/failed-to-sign-in-please-check-your-network-connection-and-try-again">Failed to sign in. Please check your network connection and try again</a></p>
  
  <p>I have also read troubleshooting guide on the same but still no luck .</p>
  
  <p>Below is my AndroidManifext.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p>
  
  <pre><code>package="com.versionpb.game"
  android:versionCode="10"
  android:versionName="1.6" &gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  
  &lt;uses-sdk tools:overrideLibrary="
  com.google.android.gms.ads,
  com.google.android.gms.ads.impl,
  com.google.android.gms,
  android.support.v4,
  android.support.compat,
  android.support.mediacompat,
  android.support.coreutils,
  android.support.coreui,
  android.support.fragment,
  com.google.android.gms.admob.license ,
  com.google.android.gms.common.license,
  com.google.android.gms.gass,
  com.google.android.gms.gass.license,
  com.google.android.gms.admob.impl.license,
  com.google.example.games.basegameutils,
  com.google.android.gms.games,
  com.google.android.gms.games.license,
  com.google.android.gms.base,
  com.google.android.gms.base.license,
  com.google.android.gms.tasks,
  com.google.android.gms.tasks.license,
  com.google.android.gms.drive,
  com.google.android.gms.drive.license,
  com.google.android.gms.plus,
  com.google.android.gms.plus.license,
  com.google.android.gms.auth,
  com.google.android.gms.auth.license,
  com.google.android.gms.auth.api,
  com.google.android.gms.auth.api.phone,
  com.google.android.gms.auth.api.phone.license
  " /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/briskybirdicon"
      android:label="@string/app_name"
      android:theme="@style/GdxTheme"&gt;
  &lt;meta-data
      android:name="com.google.android.gms.games.APP_ID"
      android:value="@string/app_id"/&gt;
  &lt;meta-data
      android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version"/&gt;
  
      &lt;activity
          android:name="com.versionpb.game.AndroidLauncher"
          android:label="@string/app_name" 
          android:screenOrientation="portrait"
          android:configChanges="keyboard|keyboardHidden|orientation|screenSize"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is my Strings.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;string name="app_name"&gt;BriskyBird&lt;/string&gt;
  </code></pre>
  
  
  
  <pre><code>&lt;!--
  Google Play game services IDs.
  Save this file as res/values/games-ids.xml in your project.
  --&gt;
  
      &lt;!-- package_name --&gt;
      &lt;string name="package_name" translatable="false"&gt;com.versionpb.game&lt;/string&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>Below is my ids.xl</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;&lt;!-- app_id --&gt;
  &lt;string name="app_id" translatable="false"&gt;351XXXX97012&lt;/string&gt;
  &lt;!-- leaderboard High Score Easy --&gt;
  &lt;string name="leaderboard_high_score_easy" 
  translatable="false"&gt;CgkItNrXiJXXXXXXXX&lt;/string&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have used baseGameUtils from below github repo</p>
  
  <p><a href="https://github.com/ahmetdenizyilmaz/connect" rel="nofollow noreferrer">https://github.com/ahmetdenizyilmaz/connect</a></p>
  
  <p>Below is my interface i have created in core project</p>
  
  <pre><code>package com.versionpb.game;
  public interface PlayServices
  {
  public void signIn();
  public void signOut();
  public void rateGame();
  public void unlockAchievement(String str);
  public void submitScore(int highScore);
  public void submitLevel(int highLevel);
  public void showAchievement();
  public void showScore();
  public void showLevel();
  public boolean isSignedIn();
  }
  </code></pre>
  
  <p>Below is how I have implemented it in the AndroidLauncher </p>
  
  <pre><code>package com.versionpb.game;
  </code></pre>
  
  <p>public class AndroidLauncher extends AndroidApplication implements PlayServices {
      private static final String TAG = "AndroidLauncher";</p>
  
  <pre><code>private GameHelper gameHelper;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
      gameHelper.enableDebugLog(true);
  
  
      GameHelper.GameHelperListener gameHelperListener = new GameHelper.GameHelperListener() {
          @Override
          public void onSignInFailed() {
          }
  
          @Override
          public void onSignInSucceeded() {
          }
      };
  
      RelativeLayout layout = new RelativeLayout(this);
      AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
      View gameView = initializeForView(new BriskyBird(this), config);
      layout.addView(gameView);
  
  
      setContentView(layout);
  
      gameHelper.setup(gameHelperListener);
  
  }
  
  
  @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() {
                  System.out.println("PlayServices:Signin In");
                  gameHelper.beginUserInitiatedSignIn();
              }
          });
      } catch (Exception e) {
          System.out.println("PlayServices:Signin in Failed");
          //Gdx.app.log("MainActivity", "Log in failed: " + e.getMessage() + ".");
      }
  }
  
  @Override
  public void signOut() {
      try {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  System.out.println("PlayServices:Signin Out");
                  gameHelper.signOut();
              }
          });
      } catch (Exception e) {
          //Gdx.app.log("MainActivity", "Log out failed: " + e.getMessage() + ".");
      }
  }
  
  @Override
  public void rateGame() {
  
      String str = "Your PlayStore Link";
      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
  }
  
  @Override
  public void unlockAchievement(String str) {
      Games.Achievements.unlock(gameHelper.getApiClient(), str);
  }
  
  
  
  @Override
  public void showAchievement() {
      if (isSignedIn()) {
          startActivityForResult(Games.Achievements.getAchievementsIntent(gameHelper.getApiClient()), 1);
      } else {
          signIn();
      }
  }
  
  
  }
  
  
  
  @Override
  public boolean isSignedIn() {
      return gameHelper.isSignedIn();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Log Cat snippet when i filter with GameHelper </p>
  
  <pre><code>04-05 19:22:48.405 15038-15038/? D/GameHelper: GameHelper: Debug log enabled.
  04-05 19:22:50.215 15038-15038/? D/GameHelper: GameHelper: Setup: requested clients: 1
  04-05 19:22:50.490 15038-15038/? D/GameHelper: GameHelper: onStart :      
  04-05 19:22:50.490 15038-15038/? D/GameHelper: GameHelper: Connecting 
  </code></pre>
  
  <p>client.
      04-05 19:22:54.335 15038-15038/? D/GameHelper: GameHelper: onConnectionFailed
      04-05 19:22:54.350 15038-15038/? D/GameHelper: GameHelper: Connection failure:
      04-05 19:22:54.400 15038-15038/? D/GameHelper: GameHelper:    - code: SIGN_IN_REQUIRED(4)
      04-05 19:22:54.400 15038-15038/? D/GameHelper: GameHelper:    - resolvable: true
      04-05 19:22:54.405 15038-15038/? D/GameHelper: GameHelper:    - details: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{427a9400: android.os.BinderProxy@427b0338}, message=null}
      04-05 19:22:54.410 15038-15038/? D/GameHelper: GameHelper: onConnectionFailed: WILL resolve because we have below the max# of attempts, 0 &lt; 3
      04-05 19:22:54.410 15038-15038/? D/GameHelper: GameHelper: onConnectionFailed: resolving problem...
      04-05 19:22:54.410 15038-15038/? D/GameHelper: GameHelper: resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{427a9400: android.os.BinderProxy@427b0338}, message=null}
      04-05 19:22:54.415 15038-15038/? D/GameHelper: GameHelper: Result has resolution. Starting it.
      04-05 19:23:06.675 15038-15038/? D/GameHelper: GameHelper: onActivityResult: req=RC_RESOLVE, resp=SIGN_IN_FAILED
      04-05 19:23:06.675 15038-15038/? D/GameHelper: GameHelper: onAR: responseCode=SIGN_IN_FAILED, so giving up.
      04-05 19:23:07.090 15038-15038/? W/GameHelper: disconnect() called when client was already disconnected.
      04-05 19:23:07.785 15038-15038/? D/GameHelper: GameHelper: Notifying LISTENER of sign-in FAILURE (error)
      04-05 19:23:46.095 15038-15038/? D/GameHelper: GameHelper: onStop
      04-05 19:23:46.100 15038-15038/? D/GameHelper: GameHelper: Client already disconnected when we got onStop.</p>
  
  <p>Errors which says wrong OAuth2 id </p>
  
  <pre><code>04-05 19:22:53.700 6982-6982/? I/Choreographer: Skipped 132 frames!  The application may be doing too much work on its main thread.
  04-05 19:22:53.725 15233-15233/? E/SELinux: Function: selinux_android_load_priority [0], There is no sepolicy file 
  
  04-05 19:22:53.725 15233-15233/? E/SELinux: Function: selinux_android_load_priority [1], There is no sepolicy version file 
  
  04-05 19:22:53.725 15233-15233/? E/SELinux: Function: selinux_android_load_priority , loading version is VE=SEPF_GT-I9300_4.3_0016
  
  
  04-05 19:22:53.725 15233-15233/? E/SELinux: selinux_android_seapp_context_reload: seapp_contexts file is loaded from /seapp_contexts
  04-05 19:22:53.795 6982-14330/? I/EventLogSendingHelper: Sending log events.
  04-05 19:22:53.845 2639-2639/? D/STATUSBAR-NetworkController: refreshSignalCluster: data=-1 bt=false
  04-05 19:22:53.865 2335-3296/? D/SSRMv2:Monitor: SIOP:: AP = 310 (read only)
  04-05 19:22:53.865 18805-28587/? W/Auth: [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
  04-05 19:22:53.865 2639-2639/? D/STATUSBAR-IconMerger: checkOverflow(384), More:false, Req:false Child:2
  04-05 19:22:53.875 26275-10131/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
  04-05 19:22:54.095 2335-2751/? I/ActivityManager: Process com.samsung.android.app.watchmanagerstub (pid 15158) (adj 13) has died.
  04-05 19:22:54.100 2335-2829/? I/ActivityManager: Process com.sec.smartcard.pinservice (pid 15180) (adj 11) has died.
  04-05 19:22:54.110 2335-2335/? I/ActivityManager: Process com.google.android.gsf.login (pid 15198) (adj 9) has died.
  04-05 19:22:54.215 2335-2478/? W/LicenseLogService: log() is called by non admin
  04-05 19:22:54.290 15038-15039/? D/dalvikvm: GC_CONCURRENT freed 433K, 15% free 10331K/12048K, paused 19ms+13ms, total 133ms
  04-05 19:22:54.335 15038-15038/? D/GameHelper: GameHelper: onConnectionFailed `
  </code></pre>
  
  <p>But i ave checked many times the SHA1 Key is correct , the one in the API of my game and one in the play game services .</p>
  
  <p>Any Clue what could be wrong ?</p>
  
  <p>Below are the steps I used to create the game in play services </p>
  
  <ol>
  <li>I have version 1.6 up and live for my game uploaded in PLay COnsole</li>
  <li>Open Console --> Game Services --> Add a New game</li>
  <li>used Tab  I don't use any Google APIs in my game yet </li>
  <li>Entered all game detils etc and saved game</li>
  <li>Clicked create a linked application</li>
  <li>Clicked on package Name and it showed me my game so i selected the game/correct package name</li>
  <li>didnt select realtime multiplayer or anti piracy etc option</li>
  <li>Clicked Save
  Clicked on Authorize your app</li>
  <li>Now here it shows me my game package name and SHA1 certificate which is again there in the game SHA 1 package which is uploaded , when i click on confirm it says linked successfuly and shows me a OAuth2 Client ID and applicaiton id</li>
  <li>I add leaderboard : just game leaderoard name as of now and clicked save . </li>
  <li>publishing and click publish game and its published </li>
  <li>Now go to Leaderboards and select leaderboard , clicked get resources , copy them and save in my Strings.xml of project code changes  with leaderboards and related code implemented </li>
  <li>Execute this all on my phone and get error as specified above .</li>
  </ol>
  
  <p>Is there anything i am doing wrong . I doubt maybe i have missed some steps like generating the release certificate using keytool </p>
  
  <p>keytool -list -keystore </p>
  
  <p>These steps are there in googles documentation of setting up play gae services , bt in my case it showed me correct SHA1 certificate so i didnt execute this command .</p>
  
  <p>What is it that i am doing wrong . Any clues </p>
  
  <p>?</p>
  
  <p>Now i tried using keytool -list -keystore </p>
  
  <p>I get a different SHA1 generated than with what is uploaded at play store .</p>
  
  <p>Which SHA1 soule be used . One at the play console and the one which Authorize my app shows or this one that is generated ?</p>
  
  <p>Thanks in advance</p>