toshiro92
toshiro92

Reputation: 1344

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 :(

Upvotes: 0

Views: 709

Answers (3)

Cruceo
Cruceo

Reputation: 6824

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.

Upvotes: 0

Rashmi.B
Rashmi.B

Reputation: 1787

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

Upvotes: 0

Lior Iluz
Lior Iluz

Reputation: 26563

  • 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.

Upvotes: 1

Related Questions