Skip to content

App crashing when signing in after integrating firebase ui on few devices #1181

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

Closed
passiondroid opened this issue Mar 9, 2018 · 10 comments
Closed

Comments

@passiondroid
Copy link

Step 1: Describe your environment

  • Android device: Samsung
  • Android OS version: 6
  • Google Play Services version: 3.2.0
  • Firebase/Play Services SDK version: 11.8.0
  • FirebaseUI version: 3.2.1

Step 2: Describe the problem:

After integrating firebase ui, it works perfectly on my devices but i am getting app crashes on fabric and not sure why it is coming. I tried to look at the existing issues here but none of them resolved it.

Observed Results:

App crashed with below log -

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.FragmentManager android.support.v4.app.FragmentActivity.getSupportFragmentManager()' on a null object reference
at com.firebase.ui.auth.util.signincontainer.IdpSignInContainer.signIn(IdpSignInContainer.java:58)
at com.firebase.ui.auth.util.signincontainer.SignInDelegate.redirectToIdpSignIn(SignInDelegate.java:344)
at com.firebase.ui.auth.util.signincontainer.SignInDelegate.startAuthMethodChoice(SignInDelegate.java:258)
at com.firebase.ui.auth.util.signincontainer.SignInDelegate.onComplete(SignInDelegate.java:152)
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:7406)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Expected Results:

App should not crash

@samtstern
Copy link
Contributor

This issue means that IdpSignInContainer.signIn() was called with a null first argument.

In SignInDelegate#redirectToIdpSignIn() this is called with the argument getActivity(), so this must be happening before onActivityCreated.

The error begins in onComplete which is called when the CredentialsClient#request() call comes back. This call is initiated in onCreate() so maybe we need to move it to onActivityCreated()?

@BenTilbrook
Copy link

BenTilbrook commented Mar 15, 2018

I'm also seeing this crash, and it seems to stop if I remove AuthUI.IdpConfig.GoogleBuilder() from my list passed to com.firebase.ui.auth.AuthUI.AuthIntentBuilder.setAvailableProviders().

My sign-in intent:

authUI.createSignInIntentBuilder()
            .setAvailableProviders(authBuilders().map { it.build() })
            .setTheme(R.style.AppTheme_SignIn)
            .setLogo(R.drawable.logo_signin)
            .build()

private fun authBuilders() = listOf(
    AuthUI.IdpConfig.EmailBuilder(),
    AuthUI.IdpConfig.GoogleBuilder(),
    AuthUI.IdpConfig.PhoneBuilder()
)

Environment:

Samsung SM-G935F (Android 7.0), logged in as an existing user.

Smart Lock triggers as soon as I open my app, and attempts to log in with that user, at which point the app crashes the the OP's stacktrace.

@samtstern
Copy link
Contributor

@btilbrook-nextfaze thanks for this, so are you saying this happens for you every time if you pick a Google credential from smartlock?

@BenTilbrook
Copy link

It's not getting as far as offering a selection of credentials to pick from. It's just automatically attempting to sign-in as the single Google account on the device.

I'm not sure what part of Smart Lock is in effect, since none of the Smart Lock options are enabled in Settings (no home address set either).

@BenTilbrook
Copy link

I've disabled auto sign-in in Smart Lock for Passwords settings on the account, but now I'm getting a different crash:

java.lang.NullPointerException: context cannot be null
    at com.firebase.ui.auth.util.Preconditions.checkNotNull(Preconditions.java:46)
    at com.firebase.ui.auth.ui.HelperActivityBase.createBaseIntent(HelperActivityBase.java:45)
    at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.createIntent(AuthMethodPickerActivity.java:77)
    at com.firebase.ui.auth.util.signincontainer.SignInDelegate.startAuthMethodChoice(SignInDelegate.java:303)
    at com.firebase.ui.auth.util.signincontainer.SignInDelegate.onComplete(SignInDelegate.java:180)
    at com.google.android.gms.tasks.zzf.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6692)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

@SUPERCILEX
Copy link
Collaborator

@btilbrook-nextfaze And you're using the latest version of FirebaseUI? It's really weird that it happens to you every single time. Some good news though, I'm working on killing the SignInDelegate and IdpSignInContainer as we speak so those bugs should be fixed soon.

@BenTilbrook
Copy link

Indeed, I'm using 3.2.2.

@BenTilbrook
Copy link

Ok, it seems perhaps disabling auto-sign in in Smart Lock for Passwords had a delay. The crash has now stopped, so that seems to suggest the crash only happens when auto sign-in in enabled.

@plugie
Copy link

plugie commented Mar 18, 2018

Found error just like @btilbrook-nextfaze
Firebase Ui version: 3.2.2'

Detail error :
http://crashes.to/s/5b6a4121e6f

@samtstern
Copy link
Contributor

This issue has been fixed and released in 3.3.0.

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

5 participants