Firebase Android: Google Sign In Failure
<p>First of all, I have to say I'm very very new to Android development so forgive me if I overlook something obvious.</p>

<p>For a university project, I have to create an app that first authenticates users via their Google Account using Firebase. I first followed the instructions I found <a href="https://firebase.google.com/docs/auth/android/google-signin" rel="noreferrer">here</a>.</p>

<p>For a start, I copy pasted <a href="https://github.com/firebase/quickstart-android/blob/master/auth/app/src/main/java/com/google/firebase/quickstart/auth/GoogleSignInActivity.java" rel="noreferrer">this code from Firebase Tutorial.</a> Everything seems to be working, except for one thing :</p>

<pre><code>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "------------------ onActivityResult ------------------");
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            Log.d(TAG, "------------------ googleSignInSuccess ------------------");
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = result.getSignInAccount();
            firebaseAuthWithGoogle(account);
            // Start menu activity once the user has been logged in
            Intent intent = new Intent(this, MenuActivity.class);
            startActivity(intent);
        } else {
            Log.d(TAG, "------------------ googleSignInFailure ------------------");
            // Google Sign In failed, update UI appropriately
            // [START_EXCLUDE]
            //Log.d(TAG, result.getStatus().getStatusMessage());
            updateUI(null);
            // [END_EXCLUDE]
        }
    }
}
</code></pre>

<p>Here, <code>result.isSuccess() == false</code>. So I think the Google authentication fails for some reason I cannot understand. I am sure I entered the right password, I also enabled Google Account authentication in my app's Firebase Console.</p>

<p>Thank you very much in advance if you can help me.</p>

<p><strong>EDIT</strong> : To be more precise, the first time I run the program on my emulator (or after each time I wipe data from it), I have to enter my Google credentials in the dedicated Google login activity that pops up. This works fine and the same activity seems to successfully authenticate me. However after that, <code>result.isSuccess()</code> is still false and I don't understand why.</p>