Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Android Studio reporting "URI is not registered"? [closed]

People also ask

What is xmlns Android?

XML namespaces are used for providing uniquely named elements and attributes in an XML document. xmlns:android describes the android namespace. Its used like this because this is a design choice by google to handle the errors at compile time.


You are having this issue because you are at the wrong destination! The correct directory for the Layout resource file has to be under "res-layout" not "res-all-layout"


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. I switched the build variant to release, and then back to debug. This caused Android Studio to reload something, and the error went away.

EDIT: Also check that you have the correct filename. I had this issue again by adding a debug AndroidManifest.xml, but mistakenly named it AndroidManifest.xml.xml.


I use Intellij IDEA but I think it will also work in Android Studio, can you see the "Event Log" at IDE right bottom corner, did it have some message like that "Android framework is detected in the project Configure", that means you should have a framework configuration. If so, just follow the message link.
In the same way, you can go to "File > Project Structure > Modules" , and then add a Android Facet.

enter image description here

by the way, if I want use a customized namespace like you do, I'll write the resource identifier as my package name as I define the AndroidManifest.xml package attribute of the manifest element, below is my code.

<manifest package="com.my.name.android">
    ...
</manifest>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/apk/res/com.my.name.android">
</RelativeLayout>

Hope this helps you.


This problem appeared suddenly for me, without any reason. I just closed all the tabs in Android Studio and re-opened the xml file which had problems. Problem solved! :)


In Android Studio 3.1.2 this error occurs due to Wrong validation of the cache memory.,

Go to Project folder and delete all the contents in .idea folder

This will delete the cache memory and reloading the project will create new cache memory folder and makes it good to go.,


My problem was that my folders were structured as:

MyProject/ res/ layout/ main.xml layout-land/ main.xml

(My Slayout-land folder was in my layout folder)

I changed the structure to this and it worked for me:

MyProject/ res/ layout/ main.xml layout-land/ main.xml

I hope that this helps!