Firebaseui-android: Crash in AuthUI.getInstance() while Signin

Created on 12 Jan 2018  路  20Comments  路  Source: firebase/FirebaseUI-Android

  • Android device: vivo X9
  • Android OS version: 6.0.1
  • Google Services version: 3.1.2
  • Firebase/Play Services SDK version: 11.8.0
  • FirebaseUI version: 3.1.3

The problem:

Crash in AuthUI.getInstance() while signin

Crash report

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.android.gms.common.api.GoogleApi.zzb(com.google.android.gms.common.api.internal.zzdd)' on a null object reference
com.google.android.gms.internal.zzdvv.zzb (Unknown Source)
com.google.android.gms.internal.zzdwc.setFirebaseUIVersion (Unknown Source)
com.google.firebase.auth.FirebaseAuth.setFirebaseUIVersion (Unknown Source)
com.firebase.ui.auth.AuthUI.getInstance (AuthUI.java:192)
com.firebase.ui.auth.AuthUI.getInstance (AuthUI.java:179)

Code to reproduce

        startActivityForResult(AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setLogo(R.mipmap.ic_launcher)
                .setIsSmartLockEnabled(false)
                .setAvailableProviders(
                        arrayListOf(AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()))
                .setTheme(R.style.LoginTheme)
                .setLogo(R.drawable.logo)
                .build(),
                requestCode)

Most helpful comment

Yeah, this has been fixed in 3.3.

All 20 comments

hey!
it worked for me with this configurations in app/build.gradle

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.bla.bla.appname"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    // Facebook Android SDK (everything)
    compile 'com.facebook.android:facebook-android-sdk:4.28.0'
    // Include all the Twitter APIs
    //compile 'com.twitter.sdk.android:twitter:3.1.1'
    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.google.firebase:firebase-storage:11.8.0'
    compile 'com.firebaseui:firebase-ui:3.1.3'
    compile 'com.google.android.gms:play-services-auth:11.8.0'

}

AND in the app

startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder()
                    .setLogo(R.mipmap.ic_launcher)
                    .setIsSmartLockEnabled(false, true)
                    .setAvailableProviders(
                            Arrays.asList(
                                    new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build(),
                                    new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                                    new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build()))
                    //.setIsSmartLockEnabled(false, true)
                    .setLogo(R.drawable.namelogo)
                    .build(), RC_SIGN_IN);

Same error is came with phone auth as well for some instances

Code that I used

`

 Bundle params = new Bundle();
    params.putString(AuthUI.EXTRA_DEFAULT_COUNTRY_CODE, "in");
    startActivityForResult(
            AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setAvailableProviders(
                            Collections.singletonList(new AuthUI.IdpConfig
                                    .Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build()))
                    .setTheme(R.style.FirebaseUITheme)
                    .build(),
            RC_SIGN_IN);

`

try to run it without the theme, if it solves the problem move the theme above the providers.
for instance when i moved the smart lock it stop crashes on the phone.

The crash came from this line:

https://github.com/firebase/FirebaseUI-Android/blob/7ca207e6aa2654f5afe76dbee12c3b6592996046/auth/src/main/java/com/firebase/ui/auth/AuthUI.java#L1922

But it seems to be coming from within GmsCore. I'll see if I can find where it's happening.

@subramanyamgv if you could provide a ZIPed up project that reproduces this crash that would be really helpful.

same issue here, doesn't work on android tv api 25, but does work on a smartphone api 25
(both emulators)

Edit: It seems to be something linked with the play store/services being installed/configured
On my Nvidia Shield TV everything works how it should

Hey all, I have deobfuscated the stack trace and am chasing this down internally.

@samtstern thanks, with luck we might get an appsee video of that happening, I'll keep you posted

I see this issue on users with ASOP and CyanogenMod Marshmallow devices so far.

We are experiencing thin in multiple android versions/devices

http://crashes.to/s/a80689a7452

In total 1k crashes in thr last 7 days

When you use Android emulators, it's common that they don't have Play Services installed with all the functionalities. You can prevent the app from crashing by checking if Google Play Services APIs are available (just prevent, not a real fix):

public boolean isGooglePlayServicesAvailable(Activity activity) {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int status = googleApiAvailability.isGooglePlayServicesAvailable(activity);
    if(status != ConnectionResult.SUCCESS) {
        if(googleApiAvailability.isUserResolvableError(status)) {
              googleApiAvailability.getErrorDialog(activity, status, 2404).show();
        }
        return false;
    }
    return true;
}

Then, you can (if you want) include an alternative sign-in method, such as a simple Email/Password screen.

Hey all.

A fix for this bug has been submitted internally, so this should be fixed in the next 1-2 Firebase Auth SDK releases depending on the release cycle.

I am going to close this issue here since there's nothing more FIrebaseUI can do, thanks for everyone who reported it!

@jemshit yes I believe those issues are related.

I am still experiencing the problem .

  1. Firebase ui version 3.2.2
  2. Code that produce error
startActivityForResult(
                            AuthUI.getInstance()
                                    .createSignInIntentBuilder()
                                    .setTheme(R.style.AppTheme)
                                    .setAvailableProviders(
                                            Arrays.asList(
                                                    new AuthUI.IdpConfig.GoogleBuilder().build(),
                                                    new AuthUI.IdpConfig.FacebookBuilder().build()))
                                    .build(),
                            RC_SIGN_IN);

Error in Crashlitic: http://crashes.to/s/a24b2c9ae71

@plugie the fix is not yet released.

@samtstern Is this issue fixed in Google Play services 12.0.1 ?
If not, which version we need to target to prevent this crash ?

This will be fixed in the next version of the Firebase SDK, which should be out in ~weeks. Thanks for your patience!

@samtstern - any update on the release of this bug fix? It's been about 1.5 months since the last comment here

Yeah, this has been fixed in 3.3.

@samtstern

try to run it without the theme, if it solves the problem move the theme above the providers. for instance when i moved the smart lock it stop crashes on the phone.

i am confused in "move the theme above the providers" do you mean take this method to above or what ? please explain
"when i moved the smart lock " where did you moved ? i dont have smart lock but it occurs

thanks

Was this page helpful?
0 / 5 - 0 ratings