-2

I've checked every site I can find for the last two days and read more that I could imagine it would take to fix this.

I had an app half made and then I couldn't get java to see a layout I had made. I hit clean like I had on many other things. Then R.java disappeared.

I deleted the layout just to be sure it wasn't the cause. R.java did not come back.

I then decided to rebuild from the previous project. About a quarter of the way through the same thing happens.

Now, half the time I start a new project R.java isn't there to begin with. And when it is there it doesn't update at all.

I have made sure to update to the newest software. I've tried "Build Project" I've tried restarting eclipse.

I have tried saving my R.java file and then when it auto deletes I replace it with the recent save. I get aapt.exe has experienced a problem and needs to close" which also happens when I try to clean the old projects to fix them.

This is wrecking my coding.

Omkar C.
  • 755
  • 8
  • 21
TheRedStig
  • 79
  • 1
  • 11
  • 7
    Welcome to StackOverflow. Posting your email address and asking for outside correspondence isn't the way this site is designed to work. All information should be posted in your question, and all comments or answers should be posted here in this thread. If you want private help, hire a consultant or ask a friend instead. :) Anything to do with this question should be posted in order to help others in the future or keep people trying to help aware of changes or additional information. Thanks. :) – Ken White Jan 06 '12 at 01:40
  • 2
    This, good sir or madam, is precisely why revision control exists. Use git, you won't even need to get a server involved. **Commit early, commit often**. – Chris Eberle Jan 06 '12 at 01:44
  • R.java is autogenerated and should not be altered by hand. Have you checked the contents of the XML files in /res/layout, /res/values, etc. to make sure they are valid? – Jason Braucht Jan 06 '12 at 02:15
  • Sorry about that. Im absolutely certain i have 0 issues with my XML files. And when u say use git i assume u mean github. yes? I've tried deleting my metadata folder and restarting and i get the same problem. This is so ridiculous. – TheRedStig Jan 06 '12 at 02:25
  • git is not github. git is a software for version control. Github is a site that hosts git repositories. But you can use any other hosting too, or none at all and keep everything on your local machine. See http://en.wikipedia.org/wiki/Git_%28software%29 and http://en.wikipedia.org/wiki/Github - there are also other version control systems out there, maybe you heard of subversion or mercurial or one of the many others around. –  Jan 06 '12 at 02:58
  • *"And when u say use git i assume u mean github. yes?"* Not necessarily. You can create your own private git repository on your own hard disk. Sure, it is a good idea to have an off-machine or off-site repository ... in case your hard-drive dies, or you fat-finger-delete your repository. But that's not what @Chris is getting at. He is saying that if you used git (for example) and committed regularly, you could review and get stuff back from the revision history. – Stephen C Jan 06 '12 at 03:03

3 Answers3

0

On eclipse package explorer menu (left menu that your projects are listed) right click, select android tools,select fix project properties, if it works, let everyone know so other people can benefit.

GiantRobot
  • 432
  • 3
  • 6
0

Check if you accidentally imported android.R, this can cause problems also. See answer from Lars here: Missing R.java file even though project cleaned

Community
  • 1
  • 1
eyespyus
  • 1,576
  • 19
  • 20
  • no joy there either. I actually tried that way back when this first happened before doing any searching hoping that would work but to no avail. – TheRedStig Jan 06 '12 at 22:25
0

I often have problems with the R file as well. Here are some things you can try:

  • Delete R.java and see if it regenerates (make sure Auto build is turn on)
  • Turn off auto build and manually compile the project
  • Go to your hidden .android folder and delete debug_keystore, then restart Eclipse and rebuild. May need to restart the computer as well.
  • Completely uninstall and reinstall Eclipse

Then there's the other suggested answers... check your XML files for errors, make sure your classes import the correct R file instead of android.R, etc.

Do you get any specific error messages in the console? This happens for ALL your projects?

Chad Schultz
  • 7,770
  • 6
  • 57
  • 96
  • Hey thanks Chad. I deleted everything and started from scratch. Havent coded in my strings yet. seemed the problems always started after i did that so hopefully it was just a problem in my coding and not something i installed incorrectly. In any case all seems to be working for now. If something changes i'll keep all posted here. Thanks again. – TheRedStig Jan 16 '12 at 03:13