1

我无法解决问题。我在 xml 中有两个清单标签。我收到以下错误:

AndroidManifest.xml:文档中根元素之前的标记必须格式正确。

我已经搜索了错误并得到了一个解决方案,即代码中有两个清单标记。如果是由于 2 个清单标记,我应该评论吗?还是由于其他原因?

这是我的 androidmanifest.xml

<<<<<<< Original

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.github.andlyticsproject"
    android:installLocation="auto"
    android:versionCode="217"
    android:versionName="2.2.3" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_STATS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="16" />

    <application
        android:name="AndlyticsApp"
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/Theme.Andlytics" >
        <activity
            android:name=".LoginActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Main"
            android:label="@string/app_name"
            android:uiOptions="splitActionBarWhenNarrow" >
        </activity>
        <activity
            android:name=".CommentsActivity"
            android:label="@string/comments" >
        </activity>
        <activity
            android:name=".ChartActivity"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".AdmobActivity"
            android:label="@string/app_name_admob" >
        </activity>
        <activity
            android:name=".AdmobAuthenticatorActivity"
            android:excludeFromRecents="true"
            android:label="@string/app_name_admob"
            android:theme="@android:style/Theme.Dialog" />
        <activity
            android:name=".PreferenceActivity"
            android:label="@string/preferences" >
        </activity>
        <activity
            android:name=".NotificationPreferenceActivity"
            android:label="@string/notifications" >
        </activity>
        <activity
            android:name=".AccountSpecificPreferenceActivity"
            android:label="@string/notifications" >
        </activity>
        <activity
            android:name=".ImportActivity"
            android:label="@string/statistics_import"
            tools:ignore="ExportedActivity" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data
                    android:host="*"
                    android:mimeType="application/zip"
                    android:pathPattern="andlytics\\.zip"
                    android:scheme="file" />
            </intent-filter>
            <!-- intent-filter android:priority="-100" -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data
                    android:mimeType="application/zip"
                    android:scheme="file" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ExportActivity"
            android:label="@string/statistics_export" >
        </activity>

        <service
            android:name=".sync.SyncAdapterService"
            android:exported="false"
            android:process=":andlytics" >
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync" />
        </service>
        <service
            android:name=".admob.AdmobAccountAuthenticator"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>

            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>
        <service
            android:name=".io.ExportService"
            android:exported="false" />
        <service
            android:name=".io.ImportService"
            android:exported="false" />

        <provider
            android:name="com.github.andlyticsproject.sync.ContentProvider"
            android:authorities="com.github.andlyticsproject"
            android:exported="false" />
        <provider
            android:name="com.github.andlyticsproject.db.AndlyticsContentProvider"
            android:authorities="com.github.andlyticsproject.db.AndlyticsContentProvider"
            android:exported="false" />

        <receiver
            android:name="com.github.andlyticsproject.sync.AlarmReceiver"
            android:exported="false"
            android:process=":remote" >
        </receiver>
    </application>

</manifest>
=======

<manifest xmlns:android="http://schemas.android.com/apk/res/android" >

    <application>
        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

>>>>>>> Added
4

2 回答 2

3

您的版本控制系统在文件(<<<<<<<>>>>>>>标签)中标记了冲突。您必须先解决冲突,然后才能使用该文件。(工具链抱怨,因为 VCS 标签是非法的 XML 语法)。

于 2012-10-09T06:01:14.220 回答
2

评论第二个清单标签。应该只有一个清单标签。

于 2012-10-09T06:02:04.653 回答