Android Studio 3.1.1 does not refresh automatically

after updating to Android Studio3.1.1 and adding xml in layout, the compiler cannot prompt that the new xml,sync is also useless

Mar.03,2021

menu: "File" - "invalidate Caches/Restart."


AS automatically determines the xml file type according to the location of the file, and gives a completion prompt. Normally, there is a logo above the res folder, as shown in the following figure:

if your project does not have such a prompt, manually add the following script to the build.gradle file:

android {
    ...
    sourceSets {
        main.res.srcDirs += 'src/main/res'
    }
    
}

after the addition is completed, Synchronize, if it still does not prompt properly. Uninstall 3.1.1 completely, download the new version and reinstall it.


is full of tricks. Please lower the version

.
Menu