Android Studio Layout:cannot find the declaration of element 'LinearLayout'

在layout文件夹下建立子文件后(),子文件夹里xml文件出现Layout:cannot find the declaration of element 'LinearLayout'

解决方案:需要在build.gradle里增加sourceSets节点将添加布局引用

注意子文件夹命名layout-XXX格式,其他格式可能依然报错

 参考https://blog.csdn.net/qq_39897005/article/details/80415910

如上操作后,可能还有这个错误

If a resource is only defined in folders with qualifiers like -land or -en, and there is no default declaration in the base folder (layout or values etc), then the app will crash if that resource is accessed on a device where the device is in a configuration missing the given qualifier.

暂时没找到解决方案

猜你喜欢

转载自blog.csdn.net/losedguest/article/details/89441307