If I change an external library: AndroidManifest,

2019-01-28 11:44发布

问题:

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.

回答1:

Try IDEA 10.5 EAP, it has improved Android support and easier SDK configuration. File | Invalidate caches may also help.



回答2:

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.



回答3:

Make sure you only have lower caps characters in the path to the file.



回答4:

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.



回答5:

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.