开发者

Eclipse - Project contains error(s) but none seen

开发者 https://www.devze.com 2023-04-05 00:27 出处:网络
My project has been running fine for weeks. I went to swap out an image today and suddenly eclipse highlighted my project saying it contained errors but did not point to any particular files. I then c

My project has been running fine for weeks. I went to swap out an image today and suddenly eclipse highlighted my project saying it contained errors but did not point to any particular files. I then cleans the project and now it is bringing 开发者_开发技巧up the message

R cannot be resolved to a variable

The gen folder is empty and I have these errors now over all my src folder. Does anyone know what to do?

All help appreciated.


Your project has an error and can not build thats why Android compiler can not generate the R class and eclipse warns you about that class. Check out all problems in the problems view. Also check project runtime and library settings if there is anything missing. You might accidentaly delete a lib or java runtime might have been changed.


When I encounter this king of 'weird' issues with *.xml resources I add one more item. I case of strings.xml I add new item and that CTRL+S the project will be rebuild and the R class will be refreshed. This usually fix the problems, and afterwards I delete the item that I added.

There are a lot of times when eclipese doesn't rebuild until you add something new (that it , until you make a change in your resources)

I hope this will help you if not , it might help to someone else having similar problems


If you did not disable the built-in Source history in Eclipse (right click on a file in Explorer view, then select Replace With -> Local History), revert to the code prior to your change, and rebuild. If it builds, figure out what the change was and adjust accordingly.

If you don't have that history, try to remember from memory. Likely it can't build the R file because one of your XML resource file is incorrect or references the wrong file.

0

精彩评论

暂无评论...
验证码 换一张
取 消