The layout <layout> in layout has no declaration in the base layout folder [error]

Solution 1:

In my case closing and reopening Android studio solved the problem. Rebuilding the project or clearing the cache didn't help.

Solution 2:

You can also try this :

File => Invalidate Caches / Restart => Invalidate and Restart.

screenshot

Solution 3:

In my case it was the use of capital letters in the file name. I left everything in lowercase and it was fixed.