java - android.content.res.Resources$NotFoundException · 字符串资源 ID #
问题描述
我收到此错误:
android.content.res.Resources$NotFoundException · 字符串资源 ID #0x2040003
在整个堆栈中,我看到它取决于:
Resources.java:322android.content.res.Resources.getText
我知道错误可能是我在某个地方调用了一个setText
没有传递字符串的地方。
我的问题是我不知道问题出在哪里。
从技术上讲,错误的行是这样的:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_web, container, false); // <-- HERE IS THE ERROR
}
布局文件是:
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.WebFragment" />
我不知道如何找到发生错误的行代码。
解决方案
它可能与此问题有关:关于 Webview 的https://issuetracker.google.com/issues/141132133 。
它也发生在我身上,就我而言,它是扩展 Webview 的 MarkdownView。显然升级 android appcompat 库解决了这个问题,但我仍然希望为当前库版本提供另一种解决方案。
因为我在 2 个不同的地方(具有相同的实现)使用了导致崩溃的元素,并且它只在其中 1 个地方崩溃。我一直在花时间搜索这个问题,但仍然不知道为什么以及如何解决它。
推荐阅读
- ios - Cordova InAppBrowser 插件在 iOS 上显示空白屏幕
- javascript - 如何在选择标签javascript中将图像添加到动态选项
- java - 如何从字符串中添加多个数字然后保存它们
- c# - Swashbuckle 全局过滤器而不是单个属性
- asp.net - 将 SQL Server 数据库列的数据类型设置为类
- java - 错误:没有找到适合 jdbc:omar\mssqlserver01:sqlserver://localhost:1433;DatabaseName=DB1FR; 的驱动程序
- python - 如何修复我的 CodeJam 2019-Round1C -Q1 答案
- wpf - 如何绑定跨窗口的值?
- data-structures - 如何在联合查找数据结构上实现 FindMin(x) 操作?
- java - ConcurrentHashMap 线程的 values() 是否安全?