FirebaseUI-Android
FirebaseUI-Android copied to clipboard
Occasional NPE with PhoneAuth
Welcome to FirebaseUI and thanks for submitting an issue!
Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.
If not, please feel free to fill in the following info so we can help faster!
Step 1: Are you in the right place?
Yes
Step 2: Describe your environment
- Android device: Redmi 5A
- Android OS version: 8.0
- Google Play Services version: 4.3.5
- Firebase/Play Services SDK version: 20.0.4
- FirebaseUI version: 7.1.1
Step 3: Describe the problem:
Getting NPE sometimes after waiting to receive OTP with Firebase UI (phone auth)
Steps to reproduce:
I think this mostly happened after setting theme with MaterialComponent DayNight
and setting forceDarkAllowed
to false
Observed Results:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.CharSequence android.view.inputmethod.InputConnection.getTextBeforeCursor(int, int)' on a null object reference
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:79)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:264)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:89)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7560)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Expected Results:
No error and crashes
Relevant Code:
<!--Override Firebase UI-->
<style name="AuthStyle" parent="Theme.MaterialComponents.DayNight">
<!--Override action bar and status bar-->
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorControlNormal">@color/colorAccent</item> <!--Spinner or non focus field underline color-->
<item name="android:colorFocusedHighlight">@color/colorAccent</item>
<!--Override Toolbar title text when using MaterialComponent-->
<item name="toolbarStyle">@style/AppToolbar</item>
<item name="materialButtonStyle">@style/AuthButton</item> <!--Customize Firebase UI button when using MaterialComponent-->
<item name="android:windowBackground">@color/whitePrimaryDark</item>
<!--Description text color-->
<item name="android:textColorTertiary">@color/primaryDarkWhite</item>
<!-- <item name="android:textColorPrimary">@color/colorPrimary</item>-->
<!--Override resend code text color-->
<item name="android:textColorSecondary">?android:textColorTertiary</item> <!--This override spinner item text too when using MaterialComponent-->
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
<!--Extend MaterialComponent Button when using MaterialComponents as app main theme-->
<style name="AuthButton" parent="Widget.MaterialComponents.Button">
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">64dip</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/whitePrimaryDark</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Button</item>
</style>
<!--Override-->
<style name="ThemeOverlay.App.Button" parent="">
<item name="colorPrimary">@color/primaryDarkAccent</item>
<item name="colorAccent">@color/primaryDarkAccent</item>
</style>
<!--Override-->
<style name="FirebaseUI.TextInputEditText.PhoneField" tools:keep="@style/FirebaseUI_TextInputEditText_PhoneField">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:inputType">number</item>
<item name="android:textColor">?android:textColorTertiary</item>
<item name="android:textColorHint">?android:textColorTertiary</item>
</style>
<!--Override-->
<style name="FirebaseUI.CountrySpinner" tools:keep="@style/FirebaseUI_CountrySpinner">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">@color/colorAccent</item> <!--Spinner underline and arrow color-->
<item name="android:textColor">?android:textColorTertiary</item> <!--Spinner placeholder text color-->
</style>
<!--End of Overriding FirebaseUI-->
Thank you for the report! I've filed an internal issue b/188591313 to track this.