如何解决在某些设备上的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与设备的密度桶不匹配,则该应用将崩溃,因为相关资产不存在。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。