“Error Parsing XML: XML declaration not well-formed” [android]

匿名 (未验证) 提交于 2019-12-03 02:38:01

问题:

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> 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!