android错误之android.content.res.Resources$NotFoundException
来源:互联网 发布:淘宝智能版 一钻 编辑:程序博客网 时间:2024/05/17 02:20
今天正好敲完了一个项目的代码,连上手机运行的时候发现报错了:
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0c0001
然后看一看报错的具体代码:
@Overridepublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {super.onCreateOptionsMenu(menu, inflater);inflater.inflate(R.menu.run_list_options, menu); // 报错}
就是“inflater.inflate(R.menu.run_list_options, menu)”这句报错。大概的意思明白了,找不到资源。
那具体是找不到什么资源呢?一开始也比较费解,后台通过查资料大概弄明白了,就是menu_run_list_options代表的xml文件中引用的资源找不到,于是打开menu/menu_run_list_options.xml 检查一下:
<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_item_new_run" android:showAsAction="always" android:icon="@android:drawable/" android:title="@string/new_run"/></menu>
于是乎问题找到了,就在 “android:icon="@android:drawable/” 这句,这里是想要引用一个图标,但句子没写完,只写到了文件夹的层面,所以应该补全:
android:icon="@android:drawable/ic_menu_add"
运行成功,问题解决。
总结:其实这个问题可以概括为一个大类,以后再遇到类似于Resources$NotFound 的问题,可能的解决方法之一就是在引用的xml文件中挨个检查引用资源的句子是否完整与正确。
0 0
- Android错误android.content.res.Resources$NotFoundException:
- android错误android.content.res.Resources$NotFoundException
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- 关于错误 android.content.res.Resources$NotFoundException
- android.content.res.Resources$NotFoundException错误处理
- 【错误反思】 android.content.res.Resources$NotFoundException
- 错误:android.content.res.Resources$NotFoundException
- 错误:android.content.res.Resources$NotFoundException
- android.content.res.Resources$NotFoundException
- android.content.res.Resources NotFoundException
- android.content.res.Resources$NotFoundException
- 聚集索引&非聚集索引
- django 错误 : 'str' object is not callable 解决
- 程序升级时跳转到应用程序的方法
- Understanding Python's "with" statement
- 数据结构第一章知识点导图
- android错误之android.content.res.Resources$NotFoundException
- sublime text 2 注册码
- AdaBoosting流程及数学证明
- 周工作报告140915
- [MVC4]ASP.NET MVC4+EF5(Lambda/Linq)读取数据
- 关于java cxf的webservice,(restfurl可以)可用asix和cxf接收
- DYNAMICRESOLUTION | NODYNAMICRESOLUTION
- jqPlot是一个灰常强大的图表工具,曲线,柱状,饼图,应该有尽有,更要命的是,调用方便~~
- 刷新界面:invalidate()和postInvalidate() 的区别及使用