Saturday, 1 April 2017

Android : URI is not registered (Settings | Project Settings | Schemas and DTDs)

Background

When you are developing android application you might sometime see following error on your layouts xml files in Android studio-
  • URI is not registered (Settings | Project Settings | Schemas and DTDs)


Everything seems correct except this error is persistent. Gradle sync works fine too. Lets see how we can resolve this.

Solution

  • Before we see how to resolve this issue make your layout file is in correct directory structure. It should be under layout folder which would be under res folder.




  • Now look at build variant tab at the bottom left of android Studio. You should see the current version set. It could be -
    • debug OR
    • release
In my case it was release. Just switch the version and then switch it back. In my case I switched it to release and then back to debug and the error was gone.


  •  If above 2 methods did not work out for you then Close all open tabs and reopen them. 
  • Last but not the least - restart Android Studio.
I know these are just silly workaround. Let me know which one works for you :)

 

3 comments:

  1. You Should Give a Name of Created New Layout as layout-land or anything instead of land but the important is to give a starting name as layout-

    ReplyDelete
  2. What to do when I have no build variants tab at the bottom left of android Studio?

    ReplyDelete
  3. Im having the same problem and your fix did not solve it but I believe its because I created a couple new layout directories outside of android studio because I could not get it to do it. I need a layout_v15 and layout_v16 and a layout for the rest. My new_app_widget.xml files in each directory do not show up as one file in android view like it used to. Instead I get the uri not registered error.

    ReplyDelete

t> UA-39527780-1 back to top