title: My app crashes on google sign-in
body: <p>I am integrating google sign-in into my android project using Firebase. Following <a href="https://www.youtube.com/watch?v=i18IGN3MAbw" rel="nofollow noreferrer">this</a> tutorial, I was able to get the login. But when I choose the account, the app crashes.</p>
  
  <p>By the way I am using Kotlin language.</p>
  
  <p>The code snippet is as follows:</p>
  
  <pre><code>class SignupActivity:AppCompatActivity(){
  
  lateinit var googleSignInClient: GoogleSignInClient
  lateinit var gso: GoogleSignInOptions
  val RC_SIGN_IN :Int =1
  lateinit var signOut:Button
  lateinit var mAuth: FirebaseAuth
  
  private var callbackManager: CallbackManager?=null
  @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.signup)
      header_signup_button.setOnClickListener {
          startActivity(Intent(this,SplashscreenActivity::class.java))
      }
      gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
              .requestIdToken(getString(R.string.default_web_client_id))
              .requestEmail()
              .build()
      googleSignInClient = GoogleSignIn.getClient(this,gso)
      mAuth = FirebaseAuth.getInstance()
      signOut = findViewById&lt;View&gt;(R.id.signOutBtn) as Button
      signOut.visibility= View.INVISIBLE
      google_signup.setOnClickListener {
          view:View?-&gt;signInGoogle()
      }
      signupemail_button.setOnClickListener {
          startActivity(Intent(this,EmailSignupActivity::class.java))
      }
  
      val fblogin_button= findViewById&lt;Button&gt;(R.id.facebook_signup)
      fblogin_button.setOnClickListener {
          callbackManager = CallbackManager.Factory.create()
          LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email"))
          if (!isloggedIn()) {
              LoginManager.getInstance().registerCallback(callbackManager,
                      object : FacebookCallback&lt;LoginResult&gt; {
                          override fun onSuccess(loginResult: LoginResult) {
                              Log.d("LoginActivity", "Facebook token" + loginResult.accessToken.token)
                              startActivity(Intent(baseContext, MainActivity::class.java))
                          }
  
                          override fun onCancel() {
                              Log.d("LoginActivity", "Facebook oncancel")
                          }
  
                          override fun onError(error: FacebookException?) {
                              Log.d("LoginActivity", "Facebook onError")
                          }
                      })
          } else {
              LoginManager.getInstance().unregisterCallback(callbackManager, object : FacebookCallback&lt;LoginResult&gt; {
                  override fun onSuccess(result: LoginResult?) {
                      GraphRequest(AccessToken.getCurrentAccessToken(), "/{user-id}/permissions/", null, HttpMethod.DELETE, GraphRequest.Callback() {
                          AccessToken.setCurrentAccessToken(null)
                          LoginManager.getInstance().logOut()
                      }).executeAsync()
                      Log.d("LoginActivity", "Facebook token" + result?.accessToken?.token)
                  }
  
                  override fun onCancel() {
                      Log.d("LoginActivityunregister", "Facebook oncancel")
                  }
  
                  override fun onError(error: FacebookException?) {
                      Log.d("LoginActivityunregister", "Facebook onError")
                  }
  
              })
          }
      }
  }
  
  private fun signInGoogle() {
      val signIntent:Intent =googleSignInClient.signInIntent
      startActivityForResult(signIntent,RC_SIGN_IN)
  }
  
  override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
      super.onActivityResult(requestCode, resultCode, data)
      if (requestCode == RC_SIGN_IN) {
      if (resultCode!= Activity.RESULT_OK) {
              val task: Task&lt;GoogleSignInAccount&gt; = GoogleSignIn.getSignedInAccountFromIntent(data)
          try {
              val account = task.getResult()
              val credential = GoogleAuthProvider.getCredential(account.idToken,null)
              mAuth.signInWithCredential(credential)
                      .addOnCompleteListener(this, OnCompleteListener&lt;AuthResult&gt;(){
                          if (task.isSuccessful) {
                              val user = mAuth.currentUser
                              if (user != null) {
                                  updateUI(user)
                              }
                          }else{
                              updateUI(null)
                          }
                      })
          }catch (e:ApiException){
              Toast.makeText(this,e.toString(),Toast.LENGTH_SHORT).show()
          }
  
          }
      }
      else {
          callbackManager?.onActivityResult(requestCode, resultCode, data)
      }
  }
  private fun updateUI(user: FirebaseUser?) {
      val disptext = findViewById&lt;View&gt;(R.id.disptxt) as TextView
      if (user != null) {
          disptext.text = user.displayName
      }
      signOut.visibility=View.VISIBLE
      signOut.setOnClickListener { view:View-&gt;
          googleSignInClient.signOut().addOnCompleteListener {
              task -&gt; disptext.text = " "
              signOut.visibility= View.INVISIBLE
          }
      }
  }
  
  @SuppressLint("NewApi")
  override fun onBackPressed() {
      super.onBackPressed()
      startActivity(Intent(this,SplashscreenActivity::class.java))
    }
  }
  private fun Any.unregisterCallback(callbackManager: CallbackManager?, facebookCallback: FacebookCallback&lt;LoginResult&gt;) {
  
  }
  
  fun isloggedIn(): Boolean {
  val accessToken = AccessToken.getCurrentAccessToken()
  return accessToken != null
  }
  </code></pre>
  
  <p>The manifest file: In the manifest file I have added the metadata.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  package="com.example.vishwa.imaginators"&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/myicon"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".SplashscreenActivity"
          android:theme="@style/AppTheme"
          android:noHistory="true"&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;activity android:name=".LoginActivity"&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".SigninActivity"&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".SignupActivity"&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".EmailSignupActivity"&gt;
      &lt;/activity&gt;
      &lt;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
      &lt;meta-data android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/facebook_app_id" /&gt;
  
      &lt;activity android:name="com.facebook.FacebookActivity"
          android:configChanges=
              "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/app_name"/&gt;
      &lt;activity android:name=".MainActivity"&gt;
  
      &lt;/activity&gt;
   &lt;/application&gt;
  
   &lt;/manifest&gt;
  </code></pre>
  
  <p>The error that comes is <code>Caused by: com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException: 10</code>. I have looked up this <a href="https://stackoverflow.com/questions/47279161/runtimeexecutionexception-com-google-android-gms-common-api-apiexception-13-e">issue</a> and no answer solves my problem.</p>
  
  <p>I'm posting the error log as well for more clarity.</p>
  
  <pre><code>FATAL EXCEPTION: main
                Process: com.example.vishwa.imaginators, PID: 27350
                java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=Intent { (has extras) }} to activity {com.example.vishwa.imaginators/com.example.vishwa.imaginators.SignupActivity}: com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException: 10: 
                    at android.app.ActivityThread.deliverResults(ActivityThread.java:3772)
                    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3815)
                    at android.app.ActivityThread.access$1500(ActivityThread.java:154)
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430)
                    at android.os.Handler.dispatchMessage(Handler.java:102)
                    at android.os.Looper.loop(Looper.java:157)
                    at android.app.ActivityThread.main(ActivityThread.java:5571)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
                 Caused by: com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException: 10: 
                    at com.google.android.gms.tasks.zzu.getResult(Unknown Source)
                    at com.example.vishwa.imaginators.SignupActivity.onActivityResult(SignupActivity.kt:117)
                    at android.app.Activity.dispatchActivityResult(Activity.java:6562)
                    at android.app.ActivityThread.deliverResults(ActivityThread.java:3768)
                    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3815) 
                    at android.app.ActivityThread.access$1500(ActivityThread.java:154) 
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430) 
                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                    at android.os.Looper.loop(Looper.java:157) 
                    at android.app.ActivityThread.main(ActivityThread.java:5571) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635) 
                 Caused by: com.google.android.gms.common.api.ApiException: 10: 
                    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.example.vishwa.imaginators.SignupActivity.onActivityResult(SignupActivity.kt:115)
                    at android.app.Activity.dispatchActivityResult(Activity.java:6562) 
                    at android.app.ActivityThread.deliverResults(ActivityThread.java:3768) 
                    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3815) 
                    at android.app.ActivityThread.access$1500(ActivityThread.java:154) 
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430) 
                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                    at android.os.Looper.loop(Looper.java:157) 
                    at android.app.ActivityThread.main(ActivityThread.java:5571) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635) 
  </code></pre>
  
  <p>Moreover, you'll also notice that I have Facebook sign-in integration as well for my project. But now that too is not working after adding the google sign-in. Therefore I am looking forward to some help. Any help is appreciated.</p>