
Sync your project and everything will work correctly
Now go into your modules gradle.build file and create a sourceSets definition like this…(Make sure ‘src/main/res/layouts’ & ‘src/main/res’ are always the bottom two!!!! Like I am showing below).
Put the XML files you want inside the new ‘layout’ directory from the backup you made on your desktop. Do the same for fragment and adapter folders. (Note: This MUST be named ‘layout’ !!! very important) Right click the ‘activities’ directory and select new > directory once again and name this directory “layout”. (This will be the name of the type of XML files you will have in it, for example, ‘fragments’, ‘activities’ or ‘adapters’ etc.) Right click the new “layouts” directory and select new > directory. Right click the ‘res’ directory and select new > directory to create Directory in folder res which called “layouts” (I prefer calling it ‘layouts’ but this can be whatever you want, but it will not be a ‘fragment’ directory or ‘activity’ directory, that comes later). Delete the entire ‘ layout’ directory (Make sure you backed everything up from step 1!!!).
(present under android/app/src/main/res/layout)
Copy all of the XML files out of your layout directory, and put them into a directory on the desktop or something for backup.