简体   繁体   中英

My R.java file can't regenerate (Clean method)

Many people have the same problem, the R file. In my case, i have some differents packages from different projects, and then different R files. When i import all of theses packages into one, and all of R file and layouts, they(the R files) disappeared.

My question is : How i can fix this ? I had some manipulations, like the Clean method, but nothing change, and the R file never comeback :(

  • Delete the "gen" folder.
  • Clean project through Project -> Clean...

if this doesn't help, you may have a bad file name or bad encoded string in your project. Open the error file in the "gen" folder, scroll to the error.. if it's a string, just change it. If it's a bad file name, rename it.

Don't use capitalized letters in file names other than classes, no spaces...

If you have a string in a UTF-8 required language, make sure your editor is set to UTF-8 in Window -> Preferences -> General -> Workspace -> Text file encoding.

Never import any R.java. If you have any auto imported package saying import R.java, delete that as well. Clean should solve the issue. If not, then check if you have made any recent change in your xml file. At times, reverting back to your previous change solves this issue. If not, create a new project all over again. Track back your issue from where its generated

R.java is generated automatically when your program builds. If it fails to build, it can't generate the R file.

This basically means you have an error somewhere in your code that's preventing it from building.

To find the error in Eclipse, use your Problems window. If it's not open, go to Window > Show View > Problems or press the hotkey: ALT+SHIFT+Q, X

The Problems window in Eclipse will show you exactly what is preventing the application from building correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM