While creating some projects, we often encounter the problem that the R file cannot be found, which causes the code to glow everywhere and affect reading. So how to resolve this problem?
Project code clean
First clean the project, after cleaning the project R may not be generated automatically. We need to manually build the project to see if R is normal
Check whether R is imported in import and whether R can be imported automatically
If you can import the corresponding R in this step,Thats it our issue solved.
If not look at the corresponding XML file for errors, and modify it as prompted
This situation is not a problem with R, but an XML file error. Generally, it is red when the id is referenced (you can ignore this if you confirm that the xml is correct)
Look for the R file in the generated file path, if it can be found, and check whether the file size is greater than 2500k
If the file is larger than 2500k, you can fix this problem by customizing the properties of the IDE.
In Android Studio, click Help-> Edit Custom Properties in turn, and enter the following configuration. The unit is kb. You can take a look at the size of the R file and set a suitable value.