In Android Studio, can not resolve R error due to build.gradle the minmum sdk file and minSdkVersion and targetSdkVersion sdk platform must be installed, and if updates are updated first. Another thing buildToolsVersion and android.support:appcompat needs to be clear so that no ambiguity is detected. You can install them manually from build.gradle or from File -> Project Structure -> app and Flavors .
Some other causes of the R error cannot be caused by an error in the .xml file. In most cases, I solve my problem using these methods.
source share