I know this question has been many times but trust me I have checked all. Most of the question suggests to remove import android.R , remove any error in the xml file
Make sure you installed the Android build tool
form sdk manager
project right click properties-> Java BuildPath select Library and add android-support.jar
the follow these step.
Go to Project->Properties->Java Build Path than select Order and export tab. Set android-support .jar
library checked and up it into top of the list. And clean and rebuild..It works for most of the cases
Check the answer here and the thread here. Check if your layouts contain any errors (this has to be done manually or automatically only with Android Studio). Search for incorrectly closed tags like <string>
- </string>
.
EDIT (taken from this thread):
Cleaning a project removes all auto-generated files. Building the project it should automatically create them. When you Clean a project, there's an option to start a build immediately after clean up.
Here's a few things you can try (did the same procedure after manually deleting the "gen" directory.
- After you have deleted the gen directory, go to Project > Clean ...
- You should have errors indicating that R cannot be resolved to a variable. Right click on your project from the Package Explorer and select Build Project. Be sure Build Automatically option is turned off (uncheck in Project > Build Automatically).
- Errors regarding R should have now disappeared. Now, perform a Project Clean once again. All errors should be gone.