I know this question has been asked before but I am at my witts end with this. I have just created a new project and getting this error.
Ofcourse the R.java file is not
Had this happen a while back, my sdk/build-tools folder was missing a build target for some reason. Check in there to see if you have any folders.
make sure there is no error in resource file, then as soon as you build your project you will get R.java generated, point to note here is no matter whether your java code does not compile, R.java will generate if there is no problem with resource file.
If this step succeed you can import all necessary R.java file. Note that there may be multiple R.java file if you have included library project in your project. All R.java files will be in respective packages. for eg. I have "com.actionsherlock.R.java"
& "com.myproject.R.java"
in this case above case 1st import is must com.actionsherlock.R
. However, I you no library project included, you need not import R.java as this file would be generate in the same package.
In my case I am using java 1.6 and it is not supporting android 5.0 so removed those library files in android sdk, then clean the project it is working fine.
If you have any errors in your resource files, the tools will not generate an R.java file. Look for and fix all errors in the .xml files before worrying about class com.example.myfirstapp.R
not being defined. If you have no errors in the .xml files, then clean and rebuild your project.
Also, just to rule out a programming environment problem if you're using Eclipse, right-click on the project name in the Package Explorer, navigate to Android Tools and select "Fix Project Properties".
Follow simple following steps
This just worked for me.
Added a character to the manifest and saved. Deleted said character cleaned projected and package created under gen with buildconfig and R java in it.
Why is worked I have no idea.