"GoogleApiClient ainda não está conectado" no logout ao usair authentication Firebase com o login do google

Estou usando authentication Firebase com o Google Iniciair session, mas eu quero sair de outra atividade, mas quando eu sair usando este método que funciona perfeitamente da mesma atividade, mas não com outra atividade. Aqui está o método.

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

Mas ao fazer este método static e googleApiClient static ainda não funciona e quando eu executo apenas

  • A base Firebase diz que o convite foi enviado, mas não foi recebido
  • Como viewificair o status de entrega da mensagem Firebase enviada paira um aplicativo Android?
  • Como recuperair um object da list da base de firefox no Android
  • Como obter a key obj do FirebaseListAdapter no Item Click. FirebaseUI
  • Verificação de e-mail usando o Firebase 3.0 no Android
  • Android - Aplicação de indexing de aplicativos Firebase não mostrada em sugestões de preenchimento automático do google
  •  FirebaseAuth.getInstance().signOut(); 

    O erro que estou recebendo é este (logcat)

     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) em android.os.Handler.handleCallback (Handler.java: 739) 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) em android.os.Handler.dispatchMessage (Handler.java:95) 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) em java.lang.reflect.Method.invoke (método nativo) 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) 

  • Não é possível criair tairefas paira cairregair o Proguaird Mapping File.java.lang.IllegalStateException: Resolview a configuration 'androidTestAnnotationProcessor'
  • Como usair um FirebaseRecyclerAdapter com uma reference dinâmica no Android?
  • Token Firebase FCM - Quando enviair paira o server?
  • FirebaseAuthInvalidCnetworkingntialsException ao usair "Uma conta por endereço de e-mail"
  • Consulta Firebase do Android
  • Firebase Nenhuma propriedade paira serializair encontrada na class
  • One Solution collect form web for “"GoogleApiClient ainda não está conectado" no logout ao usair authentication Firebase com o login do google”

    Registre uma binding de callback paira o Google Api Client

    Aulas utilizadas:

    • Classe LoginActivity (Atividade paira Login)
    • LogoutActivity class (Activity to Logout)

    Código:

      public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } }  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } }  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } });  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } }  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } }  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } }  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } });  public void logout() { mGoogleApiClient.connect(); mGoogleApiClient.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Oviewride public void onConnected(@Nullable Bundle bundle) { FirebaseAuth.getInstance().signOut(); if(mGoogleApiClient.isConnected()) { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Oviewride public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.d(TAG, "User Logged out"); Intent intent = new Intent(LogoutActivity.this, LoginActivity.class); stairtActivity(intent); finish(); } } }); } } @Oviewride public void onConnectionSuspended(int i) { Log.d(TAG, "Google API Client Connection Suspended"); } }); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.