I would like to fix this error
R cannot be resolved to a variable
I looked up many answers, but I could not get the right one;
I have just had this problem.
It was caused because I had a redundant menu resource that referred to a non-existing string.
Removed the menu XML and back came R.