Eclipse Android - Manifest中的Parser异常

时间:2012-08-08 22:06:51

标签: android eclipse adt ddms

我正在使用ADT在Eclipse Juno中开发Android应用程序。出于某种原因,我突然在我的程序中出错(这非常简单:我在菜单中添加了一些项目,就是这样)并且出于某种原因,我的项目似乎出错了,因为尝试运行它会导致失败,因为我的项目包含错误。奇怪的是,我的菜单XML文件和我的主要活动都没有显示任何错误,只是整个项目。反过来,当我尝试清理我的项目时,这会删除我的R.java文件。现在,当我尝试重新制作“图形”项目时,在进行任何修改之前,我得到了这个DDMS错误:

[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for    /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - Graphics] Parser exception for /Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
 [2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
 [2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
[2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
 [2012-08-08 14:54:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for /nfs/guille/groce/users/nicholsk/workspace3/Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.
 [2012-08-08 14:54:25 - Graphics] Parser exception for /Graphics/AndroidManifest.xml: The markup in the document following the root element must be well-formed.

我不知道现在是什么造成了这种情况。我没有对我的库进行任何修改。在此之前,我正在另一个工作区中运行测试。谁能解释一下发生了什么?

这是我的清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphics"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
</application>

</manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphics"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
</application>

</manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphics"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

这是我的主要布局,我在yugidroid的回答中提到了错误:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world"
    tools:context=".MainActivity" />

</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world"
    tools:context=".MainActivity" />

</RelativeLayout>

4 个答案:

答案 0 :(得分:6)

我刚遇到同样的问题,我想我已经弄清楚发生了什么。我发生了什么,我有一个名为Foo的项目,第一次完全正常工作,但我删除了项目(检查选项以删除磁盘上的项目内容)。现在,当我创建另一个具有相同名称(Foo)的项目时,我收到了您在此处的错误。实际上,如果你删除项目并多次重新创建它,它每次都会添加/复制整个清单部分。

你有没有机会在你删除之前的某个时间有一个同名的项目(图形),然后开始一个同名的新项目?

答案 1 :(得分:3)

AFAIK,你的清单只能有一个根manfiest标签而你有3个!为什么呢?

尝试向我们提供以下内容:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphics"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

让我知道你的进展。

修改

您的布局也会发生同样的事情。布局文件只能有一个根标记(例如RelativeLayoutLienarLayout等)。 尝试使用以下内容替换您的布局文件内容:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world"
    tools:context=".MainActivity" />

</RelativeLayout>

答案 2 :(得分:0)

您遇到XML解析问题,因此Andorid_Manifest.xml代码会有所帮助。

示例清单看起来像

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.package"
    android:versionCode="1"
    android:versionName="1.0" >

答案 3 :(得分:0)

同样的问题,试图创建一个同名的项目。磁盘干净全部被删除但是重新启动eclipse以允许无错误生成。