我收到以下异常
java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackage/mypackage.MyActivity}: android.view.InflateException: Binary XML file line #238: Error inflating class <unknown>
我的活动 setContentView
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.myxmlfile); // >>>>>>>> This is line 238
myxmlfile.xml
<ImageView
android:id="@+id/myanimation"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_centerInParent="true"
android:background="@drawable/myanimationfile"
android:visibility="visible" />
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/myanimationfile.xml from drawable resource ID #0x7f020027
这个文件确实存在于路径 res/drawable/
在此之后我得到
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/animation00013.png from drawable resource ID #0x7f02000a
同样,动画00013.png 确实存在于路径中
我已经使用 unzip 提取了 apk 并检查了这些文件。它们存在。