如果我更改外部库:AndroidManifest,无法解析文件
我打开一个旧项目,其中注册了一个普通的 Android 2.2 外部库。我想使用 Google 地图,并将外部库更改为 Android 2.2 Google API。之后,我无法解析清单文件,并收到错误:
AnroidManifest.xml
Error: Cannot parse file
错误位于 URI 的第二行。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
如果我将鼠标悬停在错误上,则会收到消息:URI 未注册
。
更奇怪的是,当我将旧的库返回到项目(正常的 2.2)时,我仍然遇到相同的错误。
这可能是什么原因?
附言。我使用的IDE是IntelliJ IDEA。
I open an older project which has a normal Android 2.2 external library registered. I want to use Google maps and I change the external library to Android 2.2 Google APIs. After that I cannot parse the manifest file and I get an error:
AnroidManifest.xml
Error: Cannot parse file
The error is on the 2nd line in the URI
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
If I hover the error, I get the message: URI is not registered
.
What's even more weird, when I return an old lilbrary to the project (a normal 2.2), I still have the same error.
What could be the reason for this?
PS. The IDE I use is IntelliJ IDEA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试 IDEA 10.5 EAP,它改进了 Android 支持,并且更简单的 SDK 配置。 文件 |无效缓存也可能有所帮助。
Try IDEA 10.5 EAP, it has improved Android support and easier SDK configuration. File | Invalidate caches may also help.
不幸的是,我找不到这个问题的解决方案,到目前为止,解决的唯一方法是使用正确的外部库创建一个新项目并将文件复制到其中。
Unfortunatelly, I couldn't find the solution to this issue and, so far, the only way to solve is to create a new project with correct external libraries and to copy files into it.
确保文件路径中只有小写字母。
Make sure you only have lower caps characters in the path to the file.
至少在 IDEA 12 中,首选项 > Schemas 和 DTD,按 + 添加外部 Schemas 和 DTD,在 URI 编辑字段中添加“http: //schemas.android.com/apk/res/android”,按“确定”保存。这有点不稳定,我不得不做两次,但它成功了,错误消失了。
In IDEA 12 at least, Preferences > Schemas and DTDs, press the + to add External Schemas and DTDs, in the URI edit field add "http://schemas.android.com/apk/res/android", press OK to save. This was a little flaky, I had to do it twice, but it worked, the error is gone.
您也许应该检查模块的配置。请务必将相关文件夹标记为“源”、“测试源”或“已排除”。
我在
res/anim/fade_in.xml
中收到了命名空间警告。当我将项目的资源文件夹标记为“源”(如屏幕截图所示)时,命名空间错误消失了。You should maybe check the configuration of your modules. Be sure to mark the relevant folders as "Sources", "Test Sources" or "Excluded".
I had a namespace warning in
res/anim/fade_in.xml
. When I marked the resource folder of my project as "Sources" as shown in the screenshot the namespace errors disappeared.