“Error Parsing XML: XML declaration not well-forme

2019-03-03 06:03发布

问题:

I'm getting the titled error in my AndroidManifest.xml file.

The error is on the line below the < / manifest>.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.contactpicker"
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <application android:icon="@drawable/ic_launcher">
     <activity android:name=".ContactPicker" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.PICK"></action>
                <category android:name="android.intent.category.DEFAULT"></category>
                <data android:path="contacts" android:scheme="content"></data>
            </intent-filter>
        </activity>
    <activity android:name="com.example.contactpicker.ContactPickerTester"
              android:label="@string/title_activity_contact_picker_tester" >     
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER"  />
            </intent-filter>
        </activity>
    </application>

</manifest>

回答1:

Close your manifest tag. Add the >

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


回答2:

Try this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.contactpicker">
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <application android:icon="@drawable/ic_launcher">
     <activity android:name=".ContactPicker" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.PICK"></action>
                <category android:name="android.intent.category.DEFAULT"></category>
                <data android:path="contacts" android:scheme="content"></data>
            </intent-filter>
        </activity>
    <activity android:name="com.example.contactpicker.ContactPickerTester"
              android:label="@string/title_activity_contact_picker_tester" >     
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER"  />
            </intent-filter>
        </activity>
    </application>

</manifest>