0

I just worked on my current android app and created an xml-layout. But the layout was not included automatically to the R.java file. After refreshing for a while, I realized that the R.java file was deleted. I looked the file up in the project folder, but it was not there either. I googled for a while, but none of the solutions helped me. I tried cleaning, building manually, restarting eclipse etc.. I have tried to get this right for hours, but this never happened before...

So now my first question: Why is the R.java file being deleted? respectively what happens to the R.java file? And my second question is: Has anyone know why the R.java file disappears?

Kailua Bum
  • 1,368
  • 7
  • 25
  • 40
  • you must have an error in your xml files, check all files, like layout values and other – Shayan Pourvatan Apr 01 '14 at 22:26
  • see http://stackoverflow.com/questions/2757107/developing-for-android-in-eclipse-r-java-not-generating?page=2&tab=oldest#tab-top and read Muz answer (answer with 154 up) – Shayan Pourvatan Apr 01 '14 at 22:30
  • If you are still having this issue after Shayan's suggestions, checkout [this answer](http://stackoverflow.com/a/7824975/768655) as it might also be helpful. – FMontano Apr 01 '14 at 22:36
  • Last time I had this problem, it was because of an extra file in one of my resource directories (I used EMACS to edit `themes.xml`, and it left the backup file `themes.xml~` there, and apparently this screwed things up). Other possibilities: resource file names whose names don't meet Android's rules, maybe with upper-case letters in the name? – ajb Apr 01 '14 at 22:38

1 Answers1

0

Welcome to Stackoverflow.com, first go to menu, Project > Clean then if R.java can´t be created, the first that i suggest is look into the /res folder if some of the layout files or .xml have problems.

Community
  • 1
  • 1
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • Ok thanks. As I could not find a problem in my xml-files, I created a new Project and copied the code in the new Project. Until now, the R.java file was not deleted, though the new project is not really different form the old one. Maybe there was a problem in the xml-files I just did not find. But what can I do to prevent that this will not happen again? :) – SapphireHD6970 Apr 02 '14 at 11:17