Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Crash on Sign out: twitter not initialized #1278

Closed
samtstern opened this issue May 2, 2018 · 2 comments
Closed

Fatal Crash on Sign out: twitter not initialized #1278

samtstern opened this issue May 2, 2018 · 2 comments

Comments

@samtstern
Copy link
Contributor

Step 2: Describe your environment

  • FirebaseUI version: 3.4.0-dev

Step 3: Describe the problem:

Steps to reproduce:

  1. Sign in with Facebook
  2. Close app
  3. Open app again
  4. Hit sign out button in SignedInActivity

Observed Results:

05-02 15:31:37.442 17158-17158/com.firebase.uidemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.firebase.uidemo, PID: 17158
    java.lang.IllegalStateException: Must initialize Twitter before using getInstance()
        at com.twitter.sdk.android.core.Twitter.checkInitialized(Twitter.java:143)
        at com.twitter.sdk.android.core.Twitter.getInstance(Twitter.java:151)
        at com.twitter.sdk.android.core.TwitterCore.getInstance(TwitterCore.java:88)
        at com.firebase.ui.auth.AuthUI.signOutIdps(AuthUI.java:458)
        at com.firebase.ui.auth.AuthUI.signOut(AuthUI.java:383)
        at com.firebase.uidemo.auth.SignedInActivity.signOut(SignedInActivity.java:95)
        at com.firebase.uidemo.auth.SignedInActivity_ViewBinding$1.doClick(SignedInActivity_ViewBinding.java:44)
        at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Expected Results:

  • Signing out...

Relevant Code:

    private Task<Void> signOutIdps(@NonNull Context context) {
        if (ProviderAvailability.IS_FACEBOOK_AVAILABLE) {
            LoginManager.getInstance().logOut();
        }
        if (ProviderAvailability.IS_TWITTER_AVAILABLE) {
            // CRASH IS HERE
            TwitterCore.getInstance().getSessionManager().clearActiveSession();
        }
        return GoogleSignIn.getClient(context, GoogleSignInOptions.DEFAULT_SIGN_IN).signOut();
    }
@samtstern samtstern added this to the 3.4.0 milestone May 2, 2018
@samtstern samtstern self-assigned this May 2, 2018
@samtstern
Copy link
Contributor Author

This has been fixed and released in 4.0.0

@cwalsh9470
Copy link

Step 2: Describe your environment

  • FirebaseUI version: 3.4.0-dev

Step 3: Describe the problem:

Steps to reproduce:

  1. Sign in with Facebook
  2. Close app
  3. Open app again
  4. Hit sign out button in SignedInActivity

Observed Results:

05-02 15:31:37.442 17158-17158/com.firebase.uidemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.firebase.uidemo, PID: 17158
    java.lang.IllegalStateException: Must initialize Twitter before using getInstance()
        at com.twitter.sdk.android.core.Twitter.checkInitialized(Twitter.java:143)
        at com.twitter.sdk.android.core.Twitter.getInstance(Twitter.java:151)
        at com.twitter.sdk.android.core.TwitterCore.getInstance(TwitterCore.java:88)
        at com.firebase.ui.auth.AuthUI.signOutIdps(AuthUI.java:458)
        at com.firebase.ui.auth.AuthUI.signOut(AuthUI.java:383)
        at com.firebase.uidemo.auth.SignedInActivity.signOut(SignedInActivity.java:95)
        at com.firebase.uidemo.auth.SignedInActivity_ViewBinding$1.doClick(SignedInActivity_ViewBinding.java:44)
        at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Expected Results:

  • Signing out...

Relevant Code:

    private Task<Void> signOutIdps(@NonNull Context context) {
        if (ProviderAvailability.IS_FACEBOOK_AVAILABLE) {
            LoginManager.getInstance().logOut();
        }
        if (ProviderAvailability.IS_TWITTER_AVAILABLE) {
            // CRASH IS HERE
            TwitterCore.getInstance().getSessionManager().clearActiveSession();
        }
        return GoogleSignIn.getClient(context, GoogleSignInOptions.DEFAULT_SIGN_IN).signOut();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants