如何解决资源确实存在,但是Resources $ NotFoundException导致InflateException
这是关于用户的Firebase Crashlytics报告,我无法使其崩溃。每次都对我有用。
InflateException: Binary XML file line #19: Binary XML file line #19:
Error inflating class androidx.appcompat.widget.AppCompatImageButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
Caused by: Resources$NotFoundException: Drawable com.inadaydevelopment.herdboss:drawable/button_close_24dp
with resource ID #0x7f08006d
Caused by Resources$NotFoundException: File res/drawable/button_close_24dp.xml
from drawable resource ID #0x7f08006d
Caused by Resources$NotFoundException: Drawable (missing name)
with resource ID #0x7f08006e
Caused by Resources$NotFoundException: Unable to find resource ID #0x7f08006e
at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:253)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:760)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
at android.content.res.Resources.loadDrawable(Resources.java:886)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953)
at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
at android.content.res.XResources$XTypedArray.getDrawable(XResources.java:1363)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:177)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:122)
我相信resource ID #0x7f08006d
是res/drawable/button_close_24dp.xml
中定义的选择器:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button_close_grey_24dp" />
<item android:drawable="@drawable/button_close_white_24dp" />
</selector>
它引用@drawable/button_close_grey_24dp
和@drawable/button_close_white_24dp
,其中之一必须为resource ID #0x7f08006e
,这是异常根源。
每个资源都有两个版本,res/drawable
中的png和res/drawable-nodpi
中可绘制的xml向量。
据我所知,所有资源均已存在且位置适当,以便新设备或旧设备都可以找到它们。
我想念什么?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。