firebase / FirebaseUI-Android

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

Unable to start AuthUI on some Jelly Bean devices #1781

Open Zelig-74 opened 4 years ago

Zelig-74 commented 4 years ago

Environment

Android device: Samsung Galaxy S2, Galaxy Trend, Galaxy S Plus Android OS version: 4.1.2 - 4.4.2 Google Play Services version: Firebase/Play Services SDK version: 17.0.0 FirebaseUI version: 6.2.1

Describe the problem

AuthMethodPickerActivity crashes.

Steps to reproduce: Start activity AuthUI.

Observed Results: From Crashlytics I receive number of errors from devices running Android 4.1.2 to 4.4.2 (not only Samsung)

Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{cz.scamera.securitycamera/com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity}: android.view.InflateException: Binary XML file line #43: Error inflating class androidx.appcompat.widget.ActionBarContextView
Caused by android.content.res.Resources$NotFoundException
Resource ID #0x7f08001b
android.content.res.Resources.getValue (Resources.java:1884)
androidx.appcompat.widget.ResourceManagerInternal.loadDrawableFromDelegates (ResourceManagerInternal.java:252)
androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:139)
androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:132)
androidx.appcompat.widget.AppCompatDrawableManager$1.createDrawableFor (AppCompatDrawableManager.java:236)
androidx.appcompat.widget.ResourceManagerInternal.createDrawableIfNeeded (ResourceManagerInternal.java:187)
androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:141)
androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:132)
androidx.appcompat.content.res.AppCompatResources.getDrawable (AppCompatResources.java:104)
androidx.appcompat.widget.TintTypedArray.getDrawable (TintTypedArray.java:76)
androidx.appcompat.widget.ActionBarContextView.<init> (ActionBarContextView.java:70)
androidx.appcompat.widget.ActionBarContextView.<init> (ActionBarContextView.java:62)
java.lang.reflect.Constructor.constructNative (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:417)
android.view.LayoutInflater.createView (LayoutInflater.java:593)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:693)
android.view.LayoutInflater.rInflate (LayoutInflater.java:752)
android.view.LayoutInflater.rInflate (LayoutInflater.java:760)
android.view.LayoutInflater.inflate (LayoutInflater.java:495)
android.view.LayoutInflater.inflate (LayoutInflater.java:397)
android.view.LayoutInflater.inflate (LayoutInflater.java:353)
androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor (AppCompatDelegateImpl.java:749)
androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor (AppCompatDelegateImpl.java:659)
androidx.appcompat.app.AppCompatDelegateImpl.setContentView (AppCompatDelegateImpl.java:552)
androidx.appcompat.app.AppCompatActivity.setContentView (AppCompatActivity.java:161)
com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onCreate (AuthMethodPickerActivity.java:112)
android.app.Activity.performCreate (Activity.java:5207)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1094)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2085)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2146)
android.app.ActivityThread.access$700 (ActivityThread.java:140)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1238)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:177)
android.app.ActivityThread.main (ActivityThread.java:4947)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1038)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:805)
dalvik.system.NativeStart.main (NativeStart.java)

From the above, the AuthMethodPickerActivity crashes at line 112. The missing resource id 0x7f08001b is in my case androidx.appcompat.R.drawable.abc_cab_background_top_mtrl_alpha.

Expected Results:

The activity to pick auth method runs like on other devices.

Relevant Code:

Here is my build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 29
    buildToolsVersion '29.0.3'

    defaultConfig {
        applicationId "cz.test.test"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 95
        versionName "2.0.2"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true

    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}

dependencies {
    //implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation files('libs/libwebrtc.jar')

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

    implementation 'com.google.firebase:firebase-analytics:17.2.3'
    //implementation 'com.google.firebase:firebase-core:17.2.0' 
    implementation 'com.google.firebase:firebase-messaging:20.1.3'
    implementation 'com.google.firebase:firebase-auth:19.3.0'
    implementation 'com.google.firebase:firebase-firestore:21.4.1'  
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    implementation 'com.google.firebase:firebase-invites:17.0.0' 
    implementation 'com.google.firebase:firebase-ads:19.0.1'
    implementation 'com.google.firebase:firebase-functions:19.0.2'
    implementation 'com.google.firebase:firebase-config:19.1.3' 
    implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'

    implementation 'androidx.appcompat:appcompat:1.1.0' 
    implementation 'androidx.preference:preference:1.1.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0' 
    implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'com.google.android.material:material:1.2.0-alpha05' 
    implementation 'com.android.billingclient:billing:1.2.2' 

    implementation ('com.google.http-client:google-http-client-gson:1.26.0') {
        exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }
    implementation ('com.google.api-client:google-api-client-android:1.30.5') {  
        exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }
    implementation('com.google.apis:google-api-services-drive:v3-rev188-1.25.0') {
        exclude group: 'org.apache.httpcomponents'
        //exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }

    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' 
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.facebook.android:facebook-login:5.15.1'
    implementation 'com.firebaseui:firebase-ui-storage:6.2.1' 
    implementation 'com.firebaseui:firebase-ui-auth:6.2.1' 
    implementation 'com.google.code.gson:gson:2.8.5' 
    implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' 
    testImplementation 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

Is anyone else facing this problem?

akkuldn commented 4 years ago

Did you manage to fix it?

Zelig-74 commented 4 years ago

Actually not, it still crashes on some devices with Android Kitkat and bellow (SDK 16 - 19). I face this issue after migrating from Firebase UI Auth 5.1.0 to 6.2.1. I didn't get this issue on 5.1.0 (and earlier).

samtstern commented 3 years ago

It took me a while to even test this, I had to get an Android Emulator with Android 4.1 on it and manually install Play services and the Play store via APKMirror. When I did though, I couldn't reproduce this bug:

Screen Shot 2020-07-21 at 1 40 18 PM

I do believe that there is a bug here, but it doesn't seem like I am going to be able to reproduce and fix it. If someone else has a personal dev device that can reproduce this issue and wants to submit a Pull Request I would be happy to review it!

Zelig-74 commented 3 years ago

@samtstern Thank you for your work. If I manage to get a personal device that can reproduce this issue, I'll be back. Thanks again.