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) で別のプロジェクトを作成したときに、ここにあるエラーが発生しました。実際、プロジェクトを削除して何度も再作成すると、そのたびにマニフェスト セクション全体が追加/複製されます。

ひょっとして、以前に同じ名前 (Graphics) のプロジェクトを削除してから、同じ名前の新しいプロジェクトを開始したことがありますか?

于 2012-10-18T00:53:47.527 に答える
3

manfiest私の知る限り、あなたのマニフェストはルートタグを1 つしか持つことができず、あなたは 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>

進捗状況をお知らせください。

編集:

レイアウトでも同じことが起こります。レイアウト ファイルには 1 つのルート タグしか含めることができません (例: 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>
于 2012-08-08T22:43:09.170 に答える
0

同じ問題、同じ名前のプロジェクトを作成しようとしています。ディスクはすべて削除されてクリーンでしたが、エラーのない生成を可能にするためにEclipseを再起動する必要がありました.

于 2013-01-12T17:17:18.667 に答える
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 に答える