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

 

15 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. 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
  4. 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
  5. I have the same problem in AndroidManifest, recently raised. None of the solutions here works...

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

    ReplyDelete
  7. same issue ...http://schemas.android.com/apk/res/android not registered
    tried everything ....but couldn't fig out the error.

    ReplyDelete
  8. Try this one file=>invalidate catch/Restart....

    ReplyDelete
  9. Copy the URI
    Open file option>settings>Languages & frameworks>schemas and DTD's
    In ignored schemas and DTD'S click on + symbol on the right side then paste the URI . Click apply then click ok.
    Hope it solves the problem

    ReplyDelete
  10. it was really helpful, what you have to look for, please check if any XML does have a repetition/doubling of the schemas and resources. This happens if the schemas or resources have written twice by mistake and they are overlooked. Thank you, Sabihuddin.

    ReplyDelete

t> UA-39527780-1 back to top