在某些设备上的Resources $ NotFoundExceptionsetIcon

问题描述

在Google Play商店中,下面可以看到某些设备(Android 8.0和8.1)上的崩溃日志输出。但是,我无法弄清原因,因为日志输出和所有可绘制文件夹(hdpi,mdpi,xhdpi,xxhdpi,xxxhdpi)中都缺少可能缺少的资源ID,我拥有必要的PNG图像。 / p>

您知道原因可能是什么吗?

Caused by: android.content.res.Resources$NotFoundException: 
  at android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:215)
  at android.content.res.Resources.getValue (Resources.java:1316)
  at androidx.appcompat.widget.ResourceManagerInternal.createDrawableIfNeeded (ResourceManagerInternal.java:176)
  at androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:141)
  at androidx.appcompat.widget.ResourceManagerInternal.getDrawable (ResourceManagerInternal.java:132)
  at androidx.appcompat.content.res.AppCompatResources.getDrawable (AppCompatResources.java:104)
  at com.google.android.material.tabs.TabLayout$Tab.setIcon (TabLayout.java:1968)
  at com.xyz.myapp.MainActivity.setupTabIcons (MainActivity.java:184)
  at com.xyz.myapp.MainActivity.initialize (MainActivity.java:176)
  at com.xyz.myapp.MainActivity.onRequestPermissionsResult (MainActivity.java:453)
  at android.app.Activity.dispatchRequestPermissionsResult (Activity.java:7429)
  at android.app.Activity.dispatchActivityResult (Activity.java:7280)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4264)

解决方法

切换到应用程序捆绑包后,我开始获得其中一些报告。我一直认为这些用户来自于从第三方APK镜像站点下载我的应用的用户。因此,如果他们下载的APK与设备的密度桶不匹配,则该应用将崩溃,因为相关资产不存在。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...