If cleaning and rebuilding doesn’t cause the R class file to be generated, then check for errors in any of the .xml file under the res folder, especially any of the layout files. If any errors are present in any of the resource files, then the R file will not be generated regardless of how many times you clean and rebuild your project.