title: com.google.android.gms.common.api.ApiException: 16:
body: <p>I try to learn how i can use google sign in in my android App, but i catch <strong>com.google.android.gms.common.api.ApiException: 16</strong>
  And i can't find on stackoveflow answer, what is it and why i catch it. In documentation i read, what it "was canceled by user", but my google account accepted to install apps</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.util.Log
  import com.google.android.gms.auth.api.signin.GoogleSignIn
  import com.google.android.gms.auth.api.signin.GoogleSignInOptions
  import com.google.android.gms.auth.api.signin.GoogleSignInAccount
  import android.content.Intent
  import com.google.android.gms.tasks.Task
  import com.google.android.gms.common.api.ApiException
  
  class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestEmail()
                  .build()
  
          val mGoogleSignInClient = GoogleSignIn.getClient(this, gso)
          val account = GoogleSignIn.getLastSignedInAccount(this)
          if(account != null){
              Log.e("!!!", account.email)
          } else {
              val signInIntent = mGoogleSignInClient.signInIntent
              startActivityForResult(signInIntent, 0)
          }
      }
  
      public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
  
          // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
          if (requestCode == 0) {
              // The Task returned from this call is always completed, no need to attach
              // a listener.
              val task = GoogleSignIn.getSignedInAccountFromIntent(data)
              handleSignInResult(task)
          }
      }
  
      private fun handleSignInResult(completedTask: Task&lt;GoogleSignInAccount&gt;) {
          try {
              val account = completedTask.getResult(ApiException::class.java)
  
              // Signed in successfully, show authenticated UI.
              Log.e("!!!", account.email)
          } catch (e: ApiException) {
              e.printStackTrace()
          }
  
      }
  
  }
  </code></pre>
  
  <p>I followed <a href="https://developers.google.com/identity/sign-in/android/sign-in" rel="noreferrer">this guide</a>. Did the configuration of the project.
  If it's matter, i use VDS for this. Account was created in the same place</p>
  
  <p>Here is stackTrace:</p>
  
  <pre><code>com.google.android.gms.common.api.ApiException: 16: 
      at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
      at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
      at foryou.friendly.alisa.alisa.MainActivity.onActivityResult(MainActivity.kt:47)
      at android.app.Activity.dispatchActivityResult(Activity.java:7124)
      at android.app.ActivityThread.deliverResults(ActivityThread.java:4173)
      at android.app.ActivityThread.handleSendResult(ActivityThread.java:4220)
      at android.app.ActivityThread.-wrap20(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1579)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:163)
      at android.app.ActivityThread.main(ActivityThread.java:6228)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
  </code></pre>