Android – ‘cannot resolve symbol’ and ‘cannot find resource matching the given name’ – do not duplicate
I opened my project in Android studio yesterday, and "unable to resolve symbols" can be seen everywhere as a description. This is completely random, because no changes have been made to the project or as since I last opened the project. I finally updated Android studio to 2.0 and tried a series of solutions I found on the Internet, but it didn't work
Like this, I've tried:
>Rebuild project > clean up project > synchronize with gradle File > close project, close as and restart / reopen > File > invalidate cache / restart > check lint and don't see anything obvious > carefully check whether all support libraries are up-to-date in SDK manager > check my build.gradle, although it hasn't changed, it's the same as usual, It has been working the way
I also tried the following steps (from the accepted answer):
>Exit Android studio > back up ymyour Project > delete all. IML files and. Idea folders > Restart Android studio and re import the project
I also tried:
>Delete the 'Proguard' entry in build.gradle > change to "use default gradle wrapper" in preferences
Another solution is to move 'buildtypes' in build. Gradle, but' buildtypes' is already at the bottom of the Android section
If "copy" is someone who solves the same problem by doing something that can't solve my problem, please don't mark this as a duplicate
Here are some screenshots:
As you can see, the color "white" does exist:
R errors are everywhere:
These errors are also ubiquitous:
Why are there two res directories? Why is the directory with necessary resources a subdirectory of the Java directory? Does it matter? Screenshot:
Edit: I created a drawable directory in the main res directory and added a drawable that will not be picked up by the build variant. It deleted the related "unable to resolve symbols" error. However, when I deleted the main res and tried to move the entire res directory in the Java subdirectory to the main directory, I received the following error:
Edit: I try to build without error by deleting the external res directory, copying the internal Java directory, pasting it into the main directory, and then deleting the directory in the Java directory. How do these move around like I don't know? It may be because I followed the "solution" of deleting and importing the project again I don't know if Android studio will hang up in the last 20-30 minutes (sometimes). If so, I can answer my own questions in the way I solve the problem last
resolvent:
This error shows that you have no white value in the color constant. Please check all resource files (colors.xml, strings.xml, etc.) – do you have < color name = "white" > #ffffff < / color > in one of them?