"GoogleApiClient is not connected yet" on logout when using Firebase auth with google sign in
<p>I'm using Firebase auth with Google Sign In but I want to signout from another activity but when I logout using this method which works perfectly from the same activity but not with another activity. Here is the method.</p>

<pre><code>public void logOut() {
        mAuth.signOut();
        // Google sign out
        Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(
                new ResultCallback&lt;Status&gt;() {
                    @Override
                    public void onResult(@NonNull Status status) {
                        authorizeUser(null);
                    }
                });
    }
</code></pre>

<p>But when making this method static and the googleApiClient static it still doesn't work and when i perform only </p>

<pre><code>FirebaseAuth.getInstance().signOut();
</code></pre>

<p>the error i m getting is this (logcat)</p>

<pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.igov, PID: 21316
java.lang.IllegalStateException: GoogleApiClient is not connected yet.
      at com.google.android.gms.internal.zzoe.zzd(Unknown Source)
      at com.google.android.gms.internal.zzoh.zzd(Unknown Source)
      at com.google.android.gms.internal.zzof.zzd(Unknown Source)
      at com.google.android.gms.auth.api.signin.internal.zzc.signOut(Unknown Source)
      at com.igov.design.LoginActivity.logOut(LoginActivity.java:159)
      at com.igov.design.LoginActivity$2.onClick(LoginActivity.java:62)
      at android.view.View.performClick(View.java:5198)
      at com.igov.design.MainActivity.onNavigationItemSelected(MainActivity.java:101)
      at android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:152)
      at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:810)
      at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
      at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:957)
      at android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:318)
      at android.view.View.performClick(View.java:5198)
      at android.view.View$PerformClick.run(View.java:21147)
      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:5417)
      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>