firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.62k stars 1.83k forks source link

Update com.android.tools.build:gradle:4.1.0 crash at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.populateIdpList #1847

Open michelesacc opened 3 years ago

michelesacc commented 3 years ago

Hi guys,

so, everything works fine with this configuration:

classpath 'com.android.tools.build:gradle:4.0.2'

and in gradle-wrapper.properties:

distributionUrl = https \: //services.gradle.org/distributions/gradle-6.1.1-all.zip  

and:

    implementation platform ('com.google.firebase: firebase-bom: 25.11.0')
    implementation 'com.google.firebase: firebase-analytics'
    implementation 'com.google.firebase: firebase-auth'
    implementation 'com.firebaseui: firebase-ui-auth: 6.3.0'

    implementation 'com.facebook.android:facebook-android-sdk:7.1.0'
    implementation 'com.twitter.sdk.android:twitter-core:3.3.0'

But if I update everything to the latest configuration: gradle:4.1.0, gradle-6.5-all.zip

classpath 'com.android.tools.build:gradle:4.1.0'
distributionUrl = https \: //services.gradle.org/distributions/gradle-6.5-all.zip  

firebase-bom: 25.12.0', facebook-android-sdk:8.1.0'

    implementation platform ('com.google.firebase: firebase-bom: 25.12.0')
    implementation 'com.google.firebase: firebase-analytics'
    implementation 'com.google.firebase: firebase-auth'
    implementation 'com.firebaseui: firebase-ui-auth: 6.3.0'

    implementation 'com.facebook.android:facebook-android-sdk:8.1.0'
    implementation 'com.twitter.sdk.android:twitter-core:3.3.0'

I have this crash on Firebase Crashlytics on many devices, Pixel 3, Samsung Galaxy S9, Motorola Moto G (5S) Plus, with Android 8 and 9:

 AuthMethodPickerActivity.java line 221
com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.populateIdpList
Fatal Exception: java.lang.RuntimeException: Unable to start activity 
ComponentInfo {...... / com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: 
Binary XML file line # 1: Binary XML file line # 1: Error inflating class x
       at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2861)
       at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2943)
       at android.app.ActivityThread.-wrap11 (ActivityThread.java)
       at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1630)
       at android.os.Handler.dispatchMessage (Handler.java:106)
       at android.os.Looper.loop (Looper.java:164)
       at android.app.ActivityThread.main (ActivityThread.java:6626)
       at java.lang.reflect.Method.invoke (Method.java)
       at com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run (RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:811)

Some help?

samtstern commented 3 years ago

@michelesacc a few questions:

  1. Does the error message literally say Error inflating class x or did you remove something and write x?
  2. When does this happen? When FirebaseUI launches the auth method picker?
  3. Can you please try and isolate the source here? The variables are:
    1. com.android.tools.build:gradle
    2. services.gradle.org/distributions/gradle-6.5-all.zip
    3. platform ('com.google.firebase: firebase-bom: 25.12.0')
    4. 'com.facebook.android:facebook-android-sdk:8.1.0'

We need to know which one of those 4 upgrades is the problem. It's too many variables to sort through at the moment.

michelesacc commented 3 years ago

1) No, I have not removed anything. The error just says "x"

2) Yes, when the auth method picker screen is launched. But in one particular case. On first use it works. I log out. On second login, when I refuse to use Smart Lock and the auth method picker screen is shown.

3) The problem is only when updating "classpath 'com.android.tools.build:gradle:4.1.0'" which obviously needs "services.gradle.org/distributions/gradle-6.5-all.zip": "i." and "ii." they go together and this creates the crash. "iii." and "iv." they do not give problems.

samtstern commented 3 years ago

@michelesacc thank you for the clarification, that's really strange and to be honest right now I have no idea why this is happening but it's definitely a bug!

laurentiu-git commented 3 years ago

@michelesacc have you been able to reproduce this issue lately ? I've tried to reproduce it and I am not able to do so. If you are able to reproduce it, could you try with smart lock to be disabled ?

michelesacc commented 3 years ago

In debug (without Proguard) the error does not occur. By publishing the App on the Play Store, so with Proguard enable, I also get the error in the pre-launch report, with or without smart lock.

I add my code (look, smart lock disable):

       List<AuthUI.IdpConfig> providers = new ArrayList<>();

        if (googleLogin) {

            providers.add(new AuthUI.IdpConfig.GoogleBuilder().build());
        }

        if (emailLogin) {

            providers.add(new AuthUI.IdpConfig.EmailBuilder().build());
        }

        if (phoneLogin) {

            providers.add(new AuthUI.IdpConfig.PhoneBuilder().build());
        }

        if (facebookLogin) {

            AuthUI.IdpConfig facebookIdp = new AuthUI.IdpConfig.FacebookBuilder()
                    .setPermissions(Arrays.asList("public_profile", "email"))
                    .build();
            providers.add(facebookIdp);
        }

        if (twitterLogin) {

            providers.add(new AuthUI.IdpConfig.TwitterBuilder().build());
        }

        AuthUI.SignInIntentBuilder signInIntentBuilder = AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setIsSmartLockEnabled(false, false)
                .setAvailableProviders(providers);

pre-launch report

laurentiu-git commented 3 years ago

@michelesacc I've enabled proguard in debug mode and I'm still unable to reproduce it, I'll keep trying to find a way to reproduce it. If you have anymore details on how to reproduce it (do you perhaps use a custom logo/theme?) or even a demo for it, would be much appreciated.

michelesacc commented 3 years ago

I use a logo.

But I also used the logo in the old version which didn't crash:

'com.android.tools.build:gradle:4.0.2'

samtstern commented 3 years ago

@laurentiu-git thanks for trying to reproduce this! I am going to leave this open but move it to the backlog for now as I don't think we'll be able to find the cause and solution for this in time for 6.4.0

michelesacc commented 3 years ago

Hello guys,

I updated the libraries, just to check if the situation has changed, but the "pre-launch report" of the Play Console (therefore with the App obfuscated and published on the Play Store for beta testers), always the same error.

Configuration used:

``

compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
    minSdkVersion 19
    targetSdkVersion 30

....

implementation 'com.google.android.gms:play-services-auth:19.0.0'

implementation platform('com.google.firebase:firebase-bom:26.1.1')
implementation 'com.google.firebase:firebase-ads'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-config'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-functions'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.firebase:firebase-storage'

implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
implementation 'com.firebaseui:firebase-ui-storage:7.1.1'

implementation 'com.facebook.android:facebook-android-sdk:8.1.0'

implementation 'com.twitter.sdk.android:twitter-core:3.3.0'

If I use, for project:

classpath 'com.android.tools.build:gradle:4.0.2' and for "gradle-wrapper.properties"

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

everything is alright!!!

If I use the same configuration but only update the latter:

classpath 'com.android.tools.build:gradle:4.1.1' and for "gradle-wrapper.properties"

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

always same error:

Device(s) with issues Motorola Moto E5 (pettyl) - Android 8.1 Samsung Galaxy S9 (US) (starqlteue) - Android 8.0 Google Pixel 3 (blueline) - Android 9 Nokia 1 Android Go (FRT) - Android 8.1 Huawei P8 Lite (hwALE-H) - Android 5.0

Exceptions java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eatat.app/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eatat.app/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eatat.app/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eatat.app/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x java.lang.NoClassDefFoundError: aewt java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eatat.app/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class x

Has anyone been able to replicate this error?

michelesacc commented 3 years ago

just if it helps, problem disappear if I add this:

if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {

    providers.add(new AuthUI.IdpConfig.TwitterBuilder().build());
}

The problem is created by adding "Twitter Login" on my "providers" for Android version 8 and 9.