我有一个拥有超过 100.000 个用户的应用程序。但在某些设备(~50)上,我遇到了一个奇怪的异常。堆栈跟踪说,没有找到可绘制对象。
这是堆栈跟踪:
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)
我不知道为什么找不到这个drawable(它是一个xml文件)。
二进制 XML 文件第 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" />
这是 textviewxml_joker.xml 文件:
<?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>
有没有人有想法解决这个问题?
此致!