1

我正在使用 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

4 回答 4

6

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

在您删除之前的某个时间,您是否有过一个同名的项目(图形),然后又开始了一个同名的新项目?

于 2012-10-18T00:53:47.527 回答
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>

让我知道你的进展。

编辑:

你的布局也会发生同样的事情。一个布局文件只能有一个根标签(例如RelativeLayout,、LienarLayout等)。尝试将您的布局文件内容替换为以下内容:

<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>
于 2012-08-08T22:43:09.170 回答
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" >
于 2012-08-08T22:09:50.923 回答
0

同样的问题,试图创建一个同名的项目。磁盘已全部删除,但需要重新启动 eclipse 才能生成无错误。

于 2013-01-12T17:17:18.667 回答