Android 资源 $NotFoundException:资源 ID #0x7f030027 [英] Android Resources$NotFoundException: Resource ID #0x7f030027

查看:35
本文介绍了Android 资源 $NotFoundException:资源 ID #0x7f030027的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的 android 程序,当我尝试测试它时,我突然开始收到一个错误android.content.res.Resources$NotFoundException: Resource ID #0x7f030027"我所做的最后一个主要更改是添加通过支持库的操作栏,但我已经可以正常工作了.除此之外,我添加了一个新类,但即使我删除了该类及其关联文件,错误仍然会弹出.我曾多次尝试清理项目并重新启动 Eclipse 无济于事.

I was working on my android program and when I tried testing it I suddenly started getting an error that went "android.content.res.Resources$NotFoundException: Resource ID #0x7f030027" The last major change I made was adding in the action bar via the support library but I got that working fine already. Besides that I've added one new class but even if I delete the class and it's associated files the error still pops up. I have tried cleaning the project and restarting Eclipse multiple times to no avail.

这是堆栈跟踪,以防在翻译中丢失任何内容:

Here's the stack trace in case anything got lost in translation:

01-21 19:05:53.125: E/AndroidRuntime(18599): FATAL EXCEPTION: main
01-21 19:05:53.125: E/AndroidRuntime(18599): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blackhat.htmlparsingtest/com.blackhat.htmlparsingtest.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030027
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread.access$700(ActivityThread.java:143)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.os.Looper.loop(Looper.java:137)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread.main(ActivityThread.java:4950)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at java.lang.reflect.Method.invokeNative(Native Method)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at java.lang.reflect.Method.invoke(Method.java:511)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at dalvik.system.NativeStart.main(Native Method)
01-21 19:05:53.125: E/AndroidRuntime(18599): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030027
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.content.res.Resources.getValue(Resources.java:1026)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.content.res.Resources.getLayout(Resources.java:865)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.Activity.setContentView(Activity.java:1914)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:111)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at com.blackhat.htmlparsingtest.MainActivity.onCreate(MainActivity.java:39)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.Activity.performCreate(Activity.java:5179)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-21 19:05:53.125: E/AndroidRuntime(18599):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
01-21 19:05:53.125: E/AndroidRuntime(18599):    ... 11 more

我还检查了 R.java 文件并且资源确实存在,但正如我提到的清理项目,删除 R 文件并重新启动 Eclipse 没有任何作用.但是我觉得应该提到的一件事是我找到了两个 R.java 文件,一个在我的项目文件夹中与 BuildConfig.Java 一起.另一个在 android.support.v7.appcompat 中.我知道 appcompat 会导致一些问题,所以我认为值得一提以防万一.

Also I have checked the R.java file and the resource definitely exists, though as I mentioned cleaning the project, deleting the R file and restarting Eclipse does nothing. One thing I felt should be mentioned however is that I've found two R.java files, one is in my project folder along with BuildConfig.Java. The other one is in android.support.v7.appcompat. I know appcompat can cause some problems so I thought it was worth mentioning in just in case.

我什至无法让我的代码像以前一样工作,因此我们将不胜感激,如果您需要任何其他信息,请告诉我!

I can't even get my code working how it used to, so any help would be appreciated and let me know if you need any other information!

推荐答案

您可以检查您的 R 文件是否存在 Resources$NotFoundException: Resource ID #0x7f030027.它会告诉您是哪个资源造成了问题.作为替代解决方案,我认为您可能有 setText 或任何内容,只是一个 int.正如您所知道的,编译器将查找相应的资源值.所以,只需在那里连接一个空字符串作为 ""

You can check your R file for Resources$NotFoundException: Resource ID #0x7f030027. It'll tell you which resource was creating the problem. As an alternative solution I think you might have setText or any content just an int.And as you know here compiler will look for corresponding resource value. So, just concat an empty string there as ""

这篇关于Android 资源 $NotFoundException:资源 ID #0x7f030027的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆