Firebase Google+ Api error : ApiException: 10:

Before I ask the question let me mention that my code works as a seperate app, but once I impliment the code into a pre-existing app that I have made I get the exception: 10:

I will include my working code, as well as the once that will not work. But basically, my Logcat detects the problem to be at this line:

Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);

Now I appreciate all possible help, but let me tell you a few that I think are not correct. My app is not released. I did not need a SHA key or any kind of authentication when I used a mock app to test the API.But basically, I found that once I put the same code in a preexisting application, I am getting these problems. Also, I have made sure all of my imports are valid.

protected void onCreate(Bundle savedInstanceState) {
    // Here is where I set up my google API.
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
    mGoogleSignInClient = GoogleSignIn.getClient(this, gso);

    mAuth= FirebaseAuth.getInstance();

    SignInButton googleSignIn= findViewById(;
    googleSignIn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Toast.makeText(MainActivity.this,"ButtonPressed", Toast.LENGTH_SHORT).show();

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) {
        // Here is where my Logcat tells me the problem is at.
        Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
        try {
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = task.getResult(ApiException.class);
        } catch (ApiException e) {
            // Google Sign In failed, update UI appropriately
            Log.w(TAG, "Google sign in failed", e);
            // ...

private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d(TAG, "signInWithCredential:success");
                        user = mAuth.getCurrentUser();
                        Log.d(TAG, name+email+phone);
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());

// Apk of working separate app. My APK

Here is the full error on logcat enter image description here