为什么Android Studio 报告“URI 未注册"? [英] Why is Android Studio reporting "URI is not registered"?

查看:37
本文介绍了为什么Android Studio 报告“URI 未注册"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我尝试了 Android Studio,因为我真的很喜欢 Resharper,并注意到 IDE 内置了一些它们的功能.现在创建了一个默认的新项目,我添加了一个新的布局文件并想更改现有的默认hello world"示例布局,但我得到了一个URI 未注册"的信息.错误在以下几行:

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:

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

我还没有对默认生成的项目做任何其他事情.我遇到了另一个似乎相关的问题(Intellij Android 项目架构 URI没有注册?),但忽略某些东西对我来说很奇怪.我实际上尝试过,但这会导致 RelativeLayout(可能还有所有其他与 Android 相关的东西)不再被识别(错误消息:找不到元素 'RelativeLayout' 的声明").

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?

推荐答案

您遇到此问题是因为您在错误的目的地!布局资源文件的正确目录必须在res-layout"下,而不是res-all-layout"

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"

这篇关于为什么Android Studio 报告“URI 未注册"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆