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 :)

 

10 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
    Replies
    1. From your View menu, select Tool Windows, then Build Variants. Then you will see either "debug"or "release", and you can switch between these.

      Delete
  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
  4. none of them helped me
    This is not happening in my project res>layout folder but actually this is happening when I am building my application then it is happening in my debug folder layput files
    path \app\build\intermediates\data-binding-layout-out\debug\layout\layoutabc.xml

    Please help me out

    ReplyDelete
  5. I am getting this error in my AndroidManifest.xml file.


    <manifest xmlns:android="http://schemas.android.com/apk/res/android"

    In my layout files, the xmlns line is fine.

    I have tried all these solutions, but the problem persists. Do you have any suggestions?

    The project is imported. The original was probably created in Eclipse.

    ReplyDelete
  6. I have the same problem in AndroidManifest, recently raised. None of the solutions here works...

    ReplyDelete
  7. what to do when in build variant option there is nothing to show

    ReplyDelete

t> UA-39527780-1 back to top