问题出现描述:
For me this was because I was using a debug and release build variant. I added the new folders src/debug/res/layout/some_layout.xml file manually, and it didn't recognize the URI.
使用build variant的时候在src建了和main同级的目录,然后res/layout下面拷贝了一个main下面正常的布局文件。然后就在
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
上面两行报错了:
- URI is not registered ( Setting | Project Settings | Schemas and DTDs )
解决方案:
1.I switched the build variant to release, and then back to debug. This caused AS to reload something, and the error went away.这个方案没试验过
2.浏览statckoverflow其他页面的时候有人说是这版本的bug,建议升级。我升级之后重启as问题就解决了。不过我感觉具体原因应该是第一种方案说的as现在有bug,没有reload一些资源造成的。
http://stackoverflow.com/questions/16883427/why-is-android-studio-reporting-uri-is-not-registered