views:

104

answers:

2

Hi all, I'm new to Eclipse/Android development so I'm hoping this is something basic that I'm just doing wrong. Basically I've been playing around with developing Android apps and I was editing one earlier. I changed my main.xml file and when I went back to my class that runs the app all references to the "R" class were broken. I looked in the "gen" folder (Generated Java Files) and saw that the class was completely gone from the solution.

I had been debugging not 5 minutes before and didn't have any problems doing so. The only things I had done since debugging were moving 2 files from the "drawable-hdpi" folder to the assets folder and I had edited the "main.xml" file.

I've tried cleaning the project and restarting Eclipse but neither of those ideas worked. Any suggestions?

+1  A: 

Check your main.xml file. If there is a fault in it (invalid XML, wrong element name, etc), then the R.java file may not be generated properly and you will have broken references.

Also make sure that the XML file itself does not have broken references (to strings, colors, and other kinds of assets).

Re-examine properly all that has changed since the last time your application was working.

codinguser
You hit the nail on the head with this statement...Also make sure that the XML file itself does not have broken references (to strings, colors, and other kinds of assets).As soon as I took care of the broken references, I cleaned the project and it generated the missing R class for me, thx.
huffmaster
A: 

I have been in your situation before. I dont have direct answer. I assume you still learning Android (Like me) ...

The best thing is redo or rewrite the code from the beginning. It sharpen your skill, and sometimes in the middle you find the answer. It more quicker, Rather than staring the code and try to fix it.

It work for me, but need patient (which sometimes, I dont have it ...) ;)

CaramelMacchiato