title: Firebase throwing "java.lang.IllegalStateException: Task is not yet complete" exception inside onComplete
body: <p>Hello i have a situation here, I have a custom <code>FirebaseAuthLiveData</code> class extending <code>Livedata</code> and implements <code>OnCompleteListener</code>. this class basically does all the authentication related work with firebase. I’m following mvvm architecture for the app. so i’ll be observing the livedata from activity. Now the problem is i’m getting <code>Task Not Complete yet</code> exception when i try to save the value of livedata in <code>oncomplete</code>  but when i reopen the app again it’s already logged in..I have attached the class, if anyone can point out what i’m doing wrong,
  the firebase version i’m using is 11.8.0</p>
  
  <pre><code>class FirebaseAuthLiveData (private val firebaseAuth: FirebaseAuth) : LiveData&lt;Resource&lt;FirebaseUser&gt;&gt;(), OnCompleteListener&lt;AuthResult&gt;, OnFailureListener{
  
      override fun onFailure(p0: Exception) {
         value = Resource.error(p0.localizedMessage,null)
      }
  
  
      override fun onComplete(p0: Task&lt;AuthResult&gt;) {
  
          Log.d("firebase auth", "is task successful : "+p0.isSuccessful);
          if (p0.isSuccessful) {
              value = Resource.success(p0.result.user)
          }
      }
  
      //this is called from a viewmodel
      fun signInAnonymously( ){
  
          firebaseAuth.signInAnonymously()
                 .addOnFailureListener(this)
                 .addOnCompleteListener(this)
  
      }
  }
  </code></pre>
  
  <p>and here is the logcat</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.creoit.android.withdrawalwarrior, PID: 10246
  java.lang.IllegalStateException: Task is not yet complete
      at com.google.android.gms.common.internal.zzbq.zza(Unknown Source)
      at com.google.android.gms.tasks.zzn.zzbjk(Unknown Source)
      at com.google.android.gms.tasks.zzn.getResult(Unknown Source)
      at com.creoit.android.withdrawalwarrior.prior_info.PriorInfoContentActivity$signInAnonymouslyWithFirebase$1.onChanged(PriorInfoContentActivity.kt:124)
      at com.creoit.android.withdrawalwarrior.prior_info.PriorInfoContentActivity$signInAnonymouslyWithFirebase$1.onChanged(PriorInfoContentActivity.kt:33)
      at android.arch.lifecycle.LiveData.considerNotify(LiveData.java:131)
      at android.arch.lifecycle.LiveData.dispatchingValue(LiveData.java:148)
      at android.arch.lifecycle.LiveData.setValue(LiveData.java:294)
      at com.creoit.android.withdrawalwarrior.firebase.livedata.FirebaseAuthLiveData.onComplete(FirebaseAuthLiveData.kt:28)
      at com.google.android.gms.tasks.zzf.run(Unknown Source)
      at android.os.Handler.handleCallback(Handler.java:739)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at android.os.Looper.loop(Looper.java:148)
      at android.app.ActivityThread.main(ActivityThread.java:5451)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>