0

I am trying to figure this issue but I don't understand why my Vector/png drawable is missing when I put them all in respective directory/folder.

Here is the below logs.

Fatal Exception: android.view.InflateException: Binary XML file line #42 in com.ex.abc:layout/my_layout: Binary XML file line #42 in com.ex.abc:layout/my_layout: Error inflating class <unknown>

Caused by android.content.res.Resources$NotFoundException: Resource ID #0x7f0800aa
   at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:295)
   at android.content.res.Resources.getValue(Resources.java:1516)
   at androidx.appcompat.widget.ResourceManagerInternal.c(ResourceManagerInternal.java:19)
   at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:235)
   at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:2)
   at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:4)
   at com.google.android.material.resources.MaterialResources.getDrawable(MaterialResources.java:13)
   at com.google.android.material.button.MaterialButton.<init>(MaterialButton.java:87)
   at java.lang.reflect.Constructor.newInstance0(Constructor.java)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
   at android.view.LayoutInflater.createView(LayoutInflater.java:873)
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1061)
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1016)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:1178)
   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1139)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:1181)
   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1139)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:1181)
   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1139)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:696)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:548)
   at com.ex.abc.databinding.MyLayoutBinding.a(MyLayoutBinding.java:4)
   at com.ex.abc.fragments.BSDialog.Q(BSDialog.java:6)
   at androidx.fragment.app.Fragment.b0(Fragment.java:20)
   at androidx.fragment.app.DialogFragment.performCreateView(DialogFragment.java)
   at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:223)
   at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:154)
   at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1069)
   at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:91)
   at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:74)
   at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:3)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:257)
   at android.app.ActivityThread.main(ActivityThread.java:8218)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

Here is my layout file snippet code and at line 49 its drawable

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/messageBehaviorView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp">

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:orientation="horizontal">

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="0dp"
            android:layout_marginEnd="10dp"
            android:background="#afafaf">

            <Spinner
                android:id="@+id/spColorStyle"
                style="@style/spinner"
                android:contentDescription="@string/style" />
        </FrameLayout>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnAngle"
            style="@style/ButtonStyle.Circle.Small"
            android:layout_marginStart="0dp"
            android:layout_marginEnd="10dp"
            android:contentDescription="@string/rotate"
            app:icon="@drawable/ic_arrow_angle" />

    </LinearLayout>
</HorizontalScrollView>

My Vector code

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="#FFFFFF">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8s8,3.59 8,8S16.41,20 12,20M12,22c5.52,0 10,-4.48 10,-10c0,-5.52 -4.48,-10 -10,-10C6.48,2 2,6.48 2,12C2,17.52 6.48,22 12,22L12,22zM11,12l0,4h2l0,-4h3l-4,-4l-4,4H11z"/>
</vector>

enter image description here

I don't understand some android devices not able to use this resource and cause issue. My crashlytics error log for last 30 days.

enter image description here

Pratik
  • 30,639
  • 18
  • 84
  • 159
  • 1
    why your ic_arrow_angle file have two format files, if you want use verctor xml style , just delete others ic_arrow_angle.png – shuabing Feb 13 '23 at 12:49
  • This drawable created by Android Studio and I kept it. I even tried to delete png file but the result are same. – Pratik Feb 13 '23 at 13:04

1 Answers1

0

I have fixed this issue by removing all the vector drawable files and just provide png files only. After build and release crash report stopped regarding this issue.

Pratik
  • 30,639
  • 18
  • 84
  • 159