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

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

问题描述

我正在开发我的android程序,当我尝试对其进行测试时,我突然开始收到错误消息"android.content.res.Resources $ NotFoundException:资源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 Resources $ NotFoundException:资源ID#0x7f030027的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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