The layout <layout> in layout has no declaration in the base layout folder [error]
In my case closing and reopening Android studio solved the problem. Rebuilding the project or clearing the cache didn't help.
You can also try this :
File => Invalidate Caches / Restart => Invalidate and Restart.
In my case it was the use of capital letters in the file name. I left everything in lowercase and it was fixed.