R.java is not generated when creating a new project


This question already has an answer here:

  • Missing R.java file even though project cleaned 12 answers

I am building an application. When I cleaned the project using Project > Clean... my R.java file disappeared. I tried to re-generate it, but I couldn't. So I decided to create a new Android project and to copy-paste the content of my Java class file so I created a new project and the new project HAD NO R.JAVA FILE?!?!?!?!? I waited, I cleaned, re-built but no luck. I tried updating Android Plugin but it is the latest version. So my real question is:
Why When I create a new Android project R.java is not generated?

Thanks in advance,

Well, this kind of thing happens a lot with me. Most of the time, the problem is the xml tag that disappears from a xml file. Check if all your xml files have this tag at the beginning of the code:

<?xml version="1.0" encoding="utf-8"?>

If you find any xml files without this instruction in the first line, you have found your problem. I don't know what is causing this strange behavior in eclipse, but nevertheless this is, probably, the cause of your troubles.