3

Getting weird crash in Samsung android 13 devices, but this is working fine in other devices. Recently we are getting one crash in firebase crash analytics, below is the crash report . Application is targeting api level 33 and so far crash reported only in samsung android 13 devices.

edit_texts.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

   <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/login_input1_wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@color/input_field_text_color"
        android:theme="@style/login_floating_text_style">


        <com.mobileaware.unified.ui.controls.common.MaEditText
            android:id="@+id/login_input1"
            style="@style/input_field_validation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:visibility="gone" />

    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/login_input2_wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@color/input_field_text_color"
        android:theme="@style/login_floating_text_style">

    <com.mobileaware.unified.ui.controls.common.MaEditText
            android:id="@+id/login_input2"
            style="@style/input_field_validation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:visibility="gone" />

    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/login_input3_wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@color/input_field_text_color"
        android:theme="@style/login_floating_text_style">

    <com.mobileaware.unified.ui.controls.common.MaEditText
            android:id="@+id/login_input3"
            style="@style/input_field_validation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:visibility="gone" />

    </com.google.android.material.textfield.TextInputLayout>

</LinearLayout>

Stack Trace :

Fatal Exception: android.view.InflateException
Binary XML file line #21 `com.xyz.abc:layout/edit_texts: Attempt to invoke virtual method 'int android.graphics.Typeface.getWeight()' on a null object reference

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'int android.graphics.Typeface.getWeight()' on a null object reference

keyboard_arrow_up
com.google.android.material.resources.TypefaceUtils.maybeCopyWithFontWeightAdjustment (TypefaceUtils.java:57)
com.google.android.material.internal.CollapsingTextHelper.setCollapsedTypefaceInternal (CollapsingTextHelper.java:480)
com.google.android.material.internal.CollapsingTextHelper.setTypefaces (CollapsingTextHelper.java:463)
com.google.android.material.textfield.TextInputLayout.setEditText (TextInputLayout.java:1426)
com.google.android.material.textfield.TextInputLayout.addView (TextInputLayout.java:836)
android.view.ViewGroup.addView (ViewGroup.java:5268)
android.view.LayoutInflater.rInflate (LayoutInflater.java:1149)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1106)
android.view.LayoutInflater.rInflate (LayoutInflater.java:1148)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1106)
android.view.LayoutInflater.inflate (LayoutInflater.java:692)
android.view.LayoutInflater.inflate (LayoutInflater.java:544)
arrow_right

com.mobileaware.unified.ui.fragments.NativeLoginFragment.showTabs (NativeLoginFragment.java:364) com.mobileaware.unified.ui.presenters.NativeLoginFragmentPresenter.bind (NativeLoginFragmentPresenter.java:92) com.mobileaware.unified.ui.presenters.NativeLoginFragmentPresenter.loadData (NativeLoginFragmentPresenter.java:114) com.mobileaware.unified.ui.presenters.BasePresenter.loadData (BasePresenter.java:484) com.mobileaware.unified.ui.fragments.NativeLoginFragment.injectPresenter (NativeLoginFragment.java:673) com.mobileaware.unified.ui.fragments.BaseFragment.onResume (BaseFragment.java:214) com.mobileaware.unified.ui.fragments.NativeLoginFragment.onResume (NativeLoginFragment.java:1244) androidx.fragment.app.Fragment.performResume (Fragment.java:3071) androidx.fragment.app.FragmentStateManager.resume (FragmentStateManager.java:605) androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:285) androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete (SpecialEffectsController.java:771)

SHIJO CS
  • 64
  • 1
  • 13

1 Answers1

1

There's probably an issue in implementation of TextInputLayout, as it can call: (TextInputLayout.java:1426)

 collapsingTextHelper.setTypefaces(this.editText.getTypeface());

with null typeface.

It happened when turning on the Bold text in Android 13: Settings -> Display size & text -> Bold text

In my case the issue was in the style of com.google.android.material.textfield.TextInputEditText.

So try to remove and fix the style of MaEditText in your case.

MirecXP
  • 443
  • 7
  • 18