0

I'm getting really frustrated. I have been cleaning this project over and over all day long as the other posts on this subject say and it does not bring my R file back. I don't know what's going on. I updated my SDK manager. I restarted my computer. Everyone says cleaning the project is supposed to bring back the R file, but clearly something else must be the issue. Can someone please help??

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
user2593697
  • 29
  • 2
  • 6
  • 1
    if you updated from an older version of the android sdk check that you have the build tools http://stackoverflow.com/questions/16611223/how-to-fix-broken-project-where-r-no-longer-recognised/16611303#16611303 – zapl Aug 24 '13 at 23:24
  • Yes, I made sure I had all build tools. – user2593697 Aug 24 '13 at 23:35

4 Answers4

3

Ok No problem first be cool and follow some steps

step 1# Ensure that your project have no error except (R.id.something or R.layout.something)

I am sure there are error in either .xml or .java file. please check it by see in error log

Step 2#try to fined and resolve error or simply comment error line,

Step 3#clean the project and build your project, Now your R.java file apear

Alternatively Try this After doing Above step

Right click project--->properties---->compiler and change compiler compliance level

you will got solution

Shankar
  • 518
  • 5
  • 16
  • So this is what I'm seeing [2013-08-24 19:39:06 - VoiceRecognitionActivity] W/ResourceType(11820): ResXMLTree_node header size 0 is too small. [2013-08-24 19:39:06 - VoiceRecognitionActivity] C:\Users\User\workspace\VoiceRecognitionActivity\res\menu\main.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_settings'). – user2593697 Aug 24 '13 at 23:41
  • I've gotten this exact same project to work before without altering any of the code which is the weird thing. – user2593697 Aug 24 '13 at 23:44
  • Does this mean that I have to increase the size of "Tree_node header" whatever that is? Or create an action_settings string because I didn't do that last time and it still compiled. – user2593697 Aug 24 '13 at 23:53
  • Remove @string/action_setting from xml – Shankar Aug 25 '13 at 09:29
1

If you are using Eclipse, look for error markers on:

  • Resources
  • Your manifest

Repeat that for any Android library projects your app depends upon.

You might also check the Errors view in Eclipse to see what it tells you.

If you are building from the command line, your build should report the specific problem as part of your build output.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I'm using eclipse. There are no errors in the manifest or resources, just 5 error marker lightbulbs in my main activity that all say R cannot be resolved and I can't get my R file back by cleaning which has always worked for me in the past. – user2593697 Aug 24 '13 at 23:24
  • @user2593697: "There are no errors in the manifest or resources" -- there is no other likely cause for `R.java` to not be regenerated. Look at your Errors view and your Console view for error messages. Or, set yourself up to do a command-line build and see what that build tells you. – CommonsWare Aug 24 '13 at 23:26
  • Sorry I thought you meant the dreaded red x errors. There were console errors. The first says [2013-08-24 20:03:51 - VoiceRecognitionActivity] W/ResourceType(11888): ResXMLTree_node header size 0 is too small. The second says [2013-08-24 20:03:51 - VoiceRecognitionActivity] C:\Users\User\workspace\VoiceRecognitionActivity\res\menu\main.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_settings'). – user2593697 Aug 25 '13 at 00:05
  • @user2593697: You need to fix those errors. Probably they are two entries for the same root problem -- you are referencing a non-existent string resource. – CommonsWare Aug 25 '13 at 00:07
  • so does this mean the string variable is supposed to be called action_settings? – user2593697 Aug 25 '13 at 00:21
  • @user2593697: That is what your menu resource is expecting. Either add the `action_settings` string resource, or modify your `main` menu resource (e.g., have it refer to another string resource, or remove the menu item entirely). – CommonsWare Aug 25 '13 at 00:23
  • Shit that totally worked!! Last time it compiled with menu_settings?? I'm confused but so pumped now!! I appreciate the help!!! – user2593697 Aug 25 '13 at 00:33
1

I had a similar error and it took me 3 days to get the answer, mine was this same problem with this error message on the console: "ResXMLTree_node size 0 is smaller than header size 0x45"

Anytime you encounter this error, look through your recently modified xml file for any missing xml element.

Or

Check all your 'android:title' in menu file and compare with string.xml to ensure that the values are present in the string.xml file.

0

** 4/25/14 edit *** Sorry I was just informed the link to a stack overflow question is broken.

Every time I had the R problem it was this.

Problem with xml yes it could be caused by an import android.R. Something in eclipse will just drop import android.R into your code. Look for the line "Import Android.R;" and delete it.

**Edit 4/25/14 Other things I've found out about R ** Unless the class is in the default package for the App R doesn't work for me.

Community
  • 1
  • 1
danny117
  • 5,581
  • 1
  • 26
  • 35