title: Trouble Implementing Google Play Sign in with app in Android Studio
body: <p>I have followed the directions on the google developer site, but can not get it right...</p>
  
  <p>Here are my relevant code snippets from my MainActivity:</p>
  
  <p>imports:</p>
  
  <pre><code>import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.Scopes;
  import com.google.android.gms.common.api.GoogleApiClient;
  import com.google.android.gms.common.api.Scope;
  import com.google.android.gms.games.Games;
  import com.google.android.gms.plus.Plus;
  import com.google.example.games.basegameutils.BaseGameUtils;
  </code></pre>
  
  <p>implementations:</p>
  
  <pre><code>public class MainActivity extends Activity implements View.OnTouchListener,
          GoogleApiClient.ConnectionCallbacks,
          GoogleApiClient.OnConnectionFailedListener{ ...}
  </code></pre>
  
  <p>Variables:</p>
  
  <pre><code>    GoogleApiClient mGoogleApiClient;
  
  private static int RC_SIGN_IN = 9001;
  
  private boolean mResolvingConnectionFailure = false;
  private boolean mAutoStartSignInflow = true;
  private boolean mSignInClicked = false;
  
  
  
  SharedPreferences stats;
  SharedPreferences achievements;
  SharedPreferences.Editor stat_editor;
  SharedPreferences.Editor achievement_editor;
  </code></pre>
  
  <p>This is instantiated <code>onCreate()</code></p>
  
  <pre><code>        mGoogleApiClient = new GoogleApiClient.Builder(this)
              .addConnectionCallbacks(this)
              .addOnConnectionFailedListener(this)
              .addApi(Games.API).addScope(Games.SCOPE_GAMES)
                      .addScope(new Scope(Scopes.PROFILE))
                      // add other APIs and scopes here as needed
              .addApi(Plus.API)
              .build();
  </code></pre>
  
  <p>Activity cycle methods:</p>
  
  <pre><code>    @Override
  protected void onStop() {
      super.onStop();
      mGoogleApiClient.disconnect();
  }
  @Override
  protected void onStart() {
      super.onStart();
      mGoogleApiClient.connect();
  }
  </code></pre>
  
  <p>Implemented methods:</p>
  
  <pre><code>    @Override
  public void onConnected(Bundle bundle) {
      //hide sign in  button
  }
  
  @Override
  public void onConnectionSuspended(int i) {
      // Attempt to reconnect
      mGoogleApiClient.connect();
  }
  
  
  @Override
  public void onConnectionFailed(ConnectionResult connectionResult) {
      if (mResolvingConnectionFailure) {
          // already resolving
          return;
      }
  
      // if the sign-in button was clicked or if auto sign-in is enabled,
      // launch the sign-in flow
      if (mSignInClicked || mAutoStartSignInflow) {
          mAutoStartSignInflow = false;
          mSignInClicked = false;
          mResolvingConnectionFailure = true;
  
          // Attempt to resolve the connection failure using BaseGameUtils.
          // The R.string.signin_other_error value should reference a generic
          // error string in your strings.xml file, such as "There was
          // an issue with sign-in, please try again later."
          if (!BaseGameUtils.resolveConnectionFailure(this,
                  mGoogleApiClient, connectionResult,
                  RC_SIGN_IN, getString(R.string.signin_other_error))) {
              mResolvingConnectionFailure = false;
          }
      }
  
      // Put code here to display the sign-in button
  }
  
  protected void onActivityResult(int requestCode, int resultCode,
                                  Intent intent) {
      if (requestCode == RC_SIGN_IN) {
          mSignInClicked = false;
          mResolvingConnectionFailure = false;
          if (resultCode == RESULT_OK) {
              mGoogleApiClient.connect();
          } else {
              // Bring up an error dialog to alert the user that sign-in
              // failed. The R.string.signin_failure should reference an error
              // string in your strings.xml file that tells the user they
              // could not be signed in, such as "Unable to sign in."
              BaseGameUtils.showActivityResultError(this,
                      requestCode, resultCode, R.string.sign_in_failed);
          }
      }
  }
  </code></pre>
  
  <p>Note: I currently do not have a sign in button, just trying to have the user auto-prompted to sign in.</p>
  
  <p>The app crashes a second after it pops up.</p>
  
  <p>I think may be missing a meta tag or permission? Currently this is all I have.</p>
  
  <pre><code>        &lt;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.USE_CREDENTIALS" /&gt;
  </code></pre>
  
  <p>The other possibility is an improper set up on the google developer console. What all do I need to do to get this thing to connect?! I am lost!! Thanks.</p>
  
  <pre><code>08-06 17:17:23.910  30903-30939/? E/HTTPMetricsTransport﹕ transmit - MissingCredentialsException while transmitting;
  amazon.communication.MissingCredentialsException: Static Credential is unavailable.
          at com.amazon.client.metrics.transport.StaticCredentialRequestSigner.signRequest(StaticCredentialRequestSigner.java:44)
          at com.amazon.client.metrics.transport.MetricsHttpRequestSigner.signRequest(MetricsHttpRequestSigner.java:54)
          at amazon.communication.srr.HttpClientSrrManager.makeRequestSync(HttpClientSrrManager.java:190)
          at com.amazon.client.metrics.transport.HTTPMetricsTransport.makeRequest(HTTPMetricsTransport.java:286)
          at com.amazon.client.metrics.transport.HTTPMetricsTransport.attemptToTransmit(HTTPMetricsTransport.java:230)
          at com.amazon.client.metrics.transport.HTTPMetricsTransport.attemptToTransmit(HTTPMetricsTransport.java:235)
          at com.amazon.client.metrics.transport.HTTPMetricsTransport.transmit(HTTPMetricsTransport.java:202)
          at com.amazon.client.metrics.batch.transmitter.BatchTransmitter$QueuePusher.sendBatches(BatchTransmitter.java:161)
          at com.amazon.client.metrics.batch.transmitter.BatchTransmitter$QueuePusher.run(BatchTransmitter.java:127)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
          at java.lang.Thread.run(Thread.java:818)
  </code></pre>
  
  <p>Also, I read something about generating a client ID and downloading a JSON file and importing it into your project, maybe this could be the problem? I generated a client ID, but have not included any JSON file, how would I do that?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I changed to:</p>
  
  <pre><code>            mGoogleApiClient = new GoogleApiClient.Builder(this)
              .addConnectionCallbacks(this)
              .addOnConnectionFailedListener(this)
                      // add other APIs and scopes here as needed
              .addApi(Plus.API)
              .build();
  </code></pre>
  
  <p>Removing these two lines that I originally had:</p>
  
  <pre><code>                .addApi(Games.API).addScope(Games.SCOPE_GAMES)
                      .addScope(new Scope(Scopes.PROFILE))
  </code></pre>
  
  <p>The app no longer crashes when it loads, but there is still no attempt to connect, or no google sign in window that pops up.</p>