title: Firebase Google sign-in isn't working
body: <p>The button shows up and everything but for some reason, when I click it, it throws the <code>ApiException</code> error in <code>onActivityResult</code> and doesn't do anything. No popup or prompt shows.</p>
  
  <p>Activity_SignIn.java:</p>
  
  <pre><code>package com.pineapple.edufinity.clubs;
  
  import android.content.Intent;
  import android.support.annotation.NonNull;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  
  import com.google.android.gms.auth.api.signin.GoogleSignIn;
  import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
  import com.google.android.gms.auth.api.signin.GoogleSignInClient;
  import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
  import com.google.android.gms.common.SignInButton;
  import com.google.android.gms.auth.api.Auth;
  import com.google.android.gms.common.api.ApiException;
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.AuthCredential;
  import com.google.firebase.auth.AuthResult;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  import com.google.firebase.auth.GoogleAuthProvider;
  
  public class Activity_SignIn extends AppCompatActivity implements View.OnClickListener{
  
      GoogleSignInClient mGoogleSignInClient;
      private static int RC_SIGN_IN = 100;
      private FirebaseAuth mAuth;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_signin);
  
          // Configure sign-in to request the user's ID, email address, and basic
          // profile. ID and basic profile are included in DEFAULT_SIGN_IN.
          GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestIdToken("298792187574-rog3m9mrp179p24nononkl28e2v9oi4p.apps.googleusercontent.com")
                  .requestEmail()
                  .build();
          // Build a GoogleSignInClient with the options specified by gso.
          mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
  
          // Set the dimensions of the sign-in button.
          SignInButton signInButton = findViewById(R.id.sign_in_button);
          signInButton.setSize(SignInButton.SIZE_STANDARD);
          signInButton.setOnClickListener(this);
  
          mAuth = FirebaseAuth.getInstance();
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId()) {
              case R.id.sign_in_button:
                  signIn();
                  break;
              // ...
          }
      }
  
      private void signIn() {
          Intent signInIntent = mGoogleSignInClient.getSignInIntent();
          startActivityForResult(signInIntent, RC_SIGN_IN);
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
          if (requestCode == RC_SIGN_IN) {
              Task&lt;GoogleSignInAccount&gt; task = GoogleSignIn.getSignedInAccountFromIntent(data);
              try {
                  // Google Sign In was successful, authenticate with Firebase
                  GoogleSignInAccount account = task.getResult(ApiException.class);
                  firebaseAuthWithGoogle(account);
              } catch (ApiException e) {
                  // Google Sign In failed, update UI appropriately
                  Log.w("FAIL", "Google sign in failed", e);
                  // ...
              }
          }
      }
  
      private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
          final String TAG = "SIGNIN";
          Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
  
          AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
          mAuth.signInWithCredential(credential)
              .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if (task.isSuccessful()) {
                              // Sign in success, update UI with the signed-in user's information
                              Log.d(TAG, "signInWithCredential:success");
                              FirebaseUser user = mAuth.getCurrentUser();
                              updateUI(user);
                          } else {
                              // If sign in fails, display a message to the user.
                              Log.w(TAG, "signInWithCredential:failure", task.getException());
                              //Snackbar.make(findViewById(R.id.main_layout), "Authentication Failed.", Snackbar.LENGTH_SHORT).show();
                              updateUI(null);
                          }
  
                          // ...
                      }
                  });
      }
  
      @Override
      protected void onStart () {
          super.onStart();
          // Check if user is signed in (non-null) and update UI accordingly.
          FirebaseUser currentUser = mAuth.getCurrentUser();
          updateUI(currentUser);
      }
  
      private void updateUI(FirebaseUser user) {
          if(user != null){
              Intent startIntent = new Intent(getApplicationContext(), Activity_ClubsDashboard.class);
              startActivity(startIntent);
          }
      }
  }
  </code></pre>
  
  <p>activity_signin.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".Activity_SignIn"&gt;
  
      &lt;com.google.android.gms.common.SignInButton
          android:id="@+id/sign_in_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true"
          android:layout_marginBottom="140dp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>build.gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "com.pineapple.edufinity.clubs"
          minSdkVersion 24
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      //noinspection GradleCompatible
      implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
      implementation 'com.android.support.constraint:constraint-layout:1.1.2'
      implementation 'com.google.firebase:firebase-auth:16.0.2'
      implementation 'com.google.android.gms:play-services-auth:15.0.1'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p>Logcat error:</p>
  
  <pre><code>08-04 17:47:31.515 3417-3417/com.pineapple.edufinity.clubs W/FAIL: Google sign in failed
      com.google.android.gms.common.api.ApiException: 12500: 
          at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
          at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
          at com.pineapple.edufinity.clubs.Activity_SignIn.onActivityResult(Activity_SignIn.java:74)
          at android.app.Activity.dispatchActivityResult(Activity.java:6915)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:4049)
          at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096)
          at android.app.ActivityThread.-wrap20(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6077)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
  </code></pre>