“Drawable not found” 在 Android 4 版本中的崩溃问题

huangapple go评论150阅读模式
英文:

"Drawable not found" crashing issue in Android 4 version

问题

在 Firebase Crashlytics 中,我在 Android 版本 4 的手机上遇到以下错误。
文件 ic_arrow_back_black_24dp.xml 存在于 drawable 文件夹中。请帮忙解决。
https://prnt.sc/sauoit
图片中展示了现有的文件夹。

谢谢

    Fatal Exception: java.lang.RuntimeException: 无法启动组件信息{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}android.content.res.Resources$NotFoundException来自可绘制资源 ID #0x7f0800c9 的文件 res/drawable-hdpi-v4/ic_arrow_back_black_24dp.xml

    Fatal Exception: java.lang.RuntimeException: 无法启动组件信息{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}android.content.res.Resources$NotFoundException来自可绘制资源 ID #0x7f0800c9 的文件 res/drawable-xxhdpi-v4/ic_arrow_back_black_24dp.xml

    Fatal Exception: java.lang.RuntimeException: 无法启动组件信息{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}android.content.res.Resources$NotFoundException来自可绘制资源 ID #0x7f0800c9 的文件 res/drawable-v19/ic_arrow_back_black_24dp.xml


MainActivity 中的工具栏 ic_arrow_back_black_24.dp.xml

            Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
        upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
英文:

In Firebase Crashlytics, I get the following error on Android version 4 phones.
The file ic_arrow_back_black_24dp.xml exists in drawable folders. Please help.
https://prnt.sc/sauoit
Existing folders are available in the picture.

Thanks

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/ic_arrow_back_black_24dp.xml from drawable resource ID #0x7f0800c9

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/ic_arrow_back_black_24dp.xml from drawable resource ID #0x7f0800c9

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.defaultmailproject.myproject/com.defaultmailproject.myproject.ui.activities.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable-v19/ic_arrow_back_black_24dp.xml from drawable resource ID #0x7f0800c9

MainActivity Toolbar ic_arrow_back_black_24.dp.xml;

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
    upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);

答案1

得分: 1

请确保文件 "ic_arrow_back_black_24.dp.xml" 位于 drawable 文件夹中,而不是 drawable-v24 文件夹中。只需将其从 drawable-v24 文件夹中剪切并粘贴到 drawable 文件夹中。

英文:

make sure that file
ic_arrow_back_black_24.dp.xml

is in drawable folder not in drawable-v24

just cut it from drawable-v24 and paste it in drawable

huangapple
  • 本文由 发表于 2020年5月5日 02:20:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/61598997.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定