Uri is not registered android studio

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 months ago .

So I’ve given Android Studio a try, because I really like Resharper and noticed that the IDE had some of their functionality built into it. Having now created a default new project, I added a new layout file and wanted to change the existing default ‘hello world’ example layout, and I got an "URI is not registered" error on the following lines:

I’ve done nothing else to the default generated project yet. I’ve come across another question that seems to be related (Intellij Android project schema URI not registered?), but just ignoring something feels odd to me. I actually tried it, but that causes RelativeLayout (and probably all other Android related stuff) to be not recognised any more (error message: "Cannot find the declaration of element ‘RelativeLayout’").

Comments

Copy link Quote reply

Ahaochan commented May 7, 2017 •

hello , I use IntelliJ IDEA to develop thymeleaf。
but the xmlns:layout has a warning URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) 。
Although it really is useful.
how i fix the warning ? thx.

This comment has been minimized.

Copy link Quote reply

ultraq commented May 12, 2017

You can make this check go away by going to the section identified by the warning message (open your Settings, then go to Languages & Frameworks > Schemas and DTDs) and add an entry in the Ignored Schemas and DTDs section for the URL.

This comment has been minimized.

Copy link Quote reply

ekane3 commented Jul 1, 2018

How to open The android studio "settings"
being a while looking for it but no way

This comment has been minimized.

Copy link Quote reply

ultraq commented Jul 2, 2018 •

On a Mac, you can get to settings by pressing the Command + , keys, or the > Preferences menu item. I’m not so sure where to find this on Windows though. I would guess under the File menu as I can see a lot of other settings-related items in there.

I’m not 100% sure if this applies for Android Studio though — I’ve not installed the program, but given it’s based on the same IDE core that JetBrains uses for its other IDE products, I’d expect settings to be reached in the same way. Also, Android Studio might not have the same Settings layout as it’ll have different plugins installed compared to IntelliJ IDEA. This stuff looks like it belongs to an XML plugin or XML validation plugin, and given Android apps uses XML files for their manifests and configuration, I hope it’d come installed w/ Android Studio.

Читайте также:  Sapphire для sony vegas

The Schema settings are in the same place in Android as IntelliJ above: Languages & Frameworks > Schemas and DTDs , Ignored Schemas and DTDs section.

This comment has been minimized.

Copy link Quote reply

Dineshnirmania commented Sep 30, 2018

I’m also facing same issue but in android app development.

Do you know how to fix this issue in android?

So I’ve given Android Studio a try, because I really like Resharper and noticed that the IDE had some of their functionality built into it. Having now created a default new project, I added a new layout file and wanted to change the existing default ‘hello world’ example layout, and I got an “URI is not registered” error on the following lines:

I’ve done nothing else to the default generated project yet. I’ve come across another question that seems to be related (Intellij Android project schema URI not registered?), but just ignoring something feels odd to me. I actually tried it, but that causes RelativeLayout (and probably all other Android related stuff) to be not recognised any more (error message: “Cannot find the declaration of element ‘RelativeLayout’”).

Any ideas on how to solve this problem?

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”

Let me know if that solved the issue for you… good luck

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.

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.

Читайте также:  Js выделить текст в textarea

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! рџ™‚

it turns out I was editing the DEBUG version of the xml, to fix it, simply close the tab that has the error and re-open it

Its a plugins problems.

  1. Restart Your android studio.
  2. It will show a pop window for enable plugins
  3. click on enable plugins and then click on Okay.

then it will automatic restart your studio and works will fine.

hope it will works.

i had the same error. I solved it by importing the project again to the android studio.

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!

Don’t know the reason behind this error but I found out this somewhere and it solved my problem.

  • Go to “File > Project Structure > Modules”
  • Click “add (+)
  • Click “android” and “apply” and then “ok”

Sometimes this error is correlated to other errors in your manifest. Check if there are some missing dependencies and if all the tags are closed. In my case I had deleted a folder in /res folder, I restored it and that error disappeared.

For me, the offending xml files were missing the header line…

Adding that fixed it.

  • Go to “Preferences > Languages&Frameworks > Schemas and DTDS”
  • Click “add(+)”
  • Click “apply” and then “ok”

hope it will works.

For me, I was missing compile ‘com.android.support:cardview-v7:25.0.1’ in the build.gradle (Module app)

The new build system in Android Studio creates a build folder. The code inspection barfs on this folder as well as the gradle folder. These folders should proably be ignored when running code inspection.

I have raised an issue with the Android Studio team at:

I had this problem now – I created a new folder under the layout folder which would contain all the xml relate to my “home” page of my app and then another folder that would relate to my “settings” page as I wanted to organise my xml.

However, android only recognises the layout folder for xmls, not the layout/home or layout/settings folder so that is why it was giving me the error.

Thanks to Mazen Kasser answer, he assisted me in figuring this out.

Читайте также:  Xiaomi redmi note 3 pro процессор

Ran into this recently trying to migrating an existing app to material design. All I had to do to fix it was change the project’s Compile SDK Version. File | Project Settings. Select app and pick a Compile SDK version for Lollipop or higher.

Any solution mentioned here helped me. I’ll post my problem just in case is helpful to anyone.
In my case the error was happening using data binding. It seems that using data binding xmls intermediates are created. If there is an error trying to open the error will show the intermediate xml with this “URI not registered” instead of opening the right xml with the error.

Started getting this again, What actually works now is to add some rubbish inside build.gradle. Then try and sync.
When it fails remove the rubbish and re-sync.
After indexing, it works.

For most of the time it will be solved by Rebuild Project

For me I put an xml file in the values folder manually. Then the problem shows. I also noticed that the xml file name and the array-name in its I gave are same. So, I rename the xml file name and restrat Android studio.

The Problem has Gone!

I had this problem and for me it was due to creating and manipulating resource files outside Android Studio. I followed the instructions on creating new resource files and folders through Android Studio and solved the problem. You need to create a new Resource File Not directory. It will let you specify or create a directory for you if you need it. If you are creating directories for layouts for different versions, enter the info at the top including the name of the resource file you want to copy to the new folder and select Version and enter the Android version. It will create the appropriate directory with a copy of your resource in it.

Another suggestion, which was the solution for me:
I got the error in the line

in the values.xml file that was automatically generated during the build process.

It was solved by adding the android prefix in the styles.xml file.

had to be changed to

For me Plugin Android Support get Disabled somehow. Enabling Plugins again worked for me.

Try to Install the android tracker plugin. you will find it on the studio.

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *