Android Resources$NotFoundException: Resource ID #0x7f030027

CheeseCoder picture CheeseCoder · Jan 21, 2014 · Viewed 94.5k times · Source

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

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!

Answer

Manmohan Badaya picture Manmohan Badaya · Jan 22, 2014

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 ""