Android - $ NotFoundException Resources

I have an application with over 100,000 users. But on some devices (~ 50) I get a strange exception. The stack trace indicates that the available one was not found.
Here is the stack trace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{mindmApp.the.big.bang.theory.quiz/mindmApp.the.big.bang.theory.quiz.GameNormalActivity}: android.view.InflateException: Binary XML file line #237: Error inflating class ... Caused by: android.view.InflateException: Binary XML file line #237: Error inflating class at android.view.LayoutInflater.createView(LayoutInflater.java:606) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) ... Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:586) ... 28 more Caused by: android.content.res.Resources$NotFoundException: File res/drawable/textviewxml_joker.xml from drawable resource ID #0x7f02003d at android.content.res.Resources.loadDrawable(Resources.java:1956) at android.content.res.TypedArray.getDrawable(TypedArray.java:601) at android.view.View.(View.java:2841) at android.widget.TextView.(TextView.java:580) at android.widget.TextView.(TextView.java:573) 

I do not know why this drawable (this is an xml file) was not found.
Binary line of XML file # 237:

 <TextView android:id="@+id/textViewSkip" android:layout_width="0px" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:layout_weight="1" android:background="@drawable/textviewxml_joker" android:gravity="center" android:text="@string/tvSkip" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@color/color_textview" android:textSize="22sp" /> 

And here is the textviewxml_joker.xml file:

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/textview_joker_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/textview_joker"/> </selector> 

Anyone have an idea to solve this problem?

Best wishes!

+6
source share
3 answers

If your textviewxml_joker.xml file is not in drawable , but rather in the drawable-* folder, then the few devices that receive this error may not meet the conditions for using the drawable-* folder.

Put it in drawable and it should fix it.

+1
source

This can also happen if the resource you are referring to (called its ResA), in turn, refers to a resource that is missing (lets call it ResB). Android will raise a ResourceNotFoundException for ResA, although there is actually no ResB. That is life!

In my case, ResB was defined in -swxxxdp values, but not in values. So I got this exception on phones, but not on tablets.

+1
source

If you have multiple resource folders, make sure that Android finds your drawable xml for every possible combination of qualifiers ( Resource Allocation ). Looking at the types of devices that have this error, you can give a hint where to look.

0
source

All Articles