简体   繁体   中英

The Android Manifest.xml is getting corrupted

I have encountered an un-debug-able problem for my last three projects. The same error I get after creating every two-three activities in each project is :-

Parser Exception :  The markup in the document preceding the root element must be well formed.

This error comes in the AndroidManifest.xml file.

I'm using ADT Eclipse provided by Google for the purpose.

Is this error debuggable or I have to just delete the project and start overall again till the error comes again?

package="com.example.sqlitenew"

android:versionCode="1"

android:versionName="1.0" >


<uses-sdk

    android:minSdkVersion="8"

    android:targetSdkVersion="17" />


<application

    android:allowBackup="true"

    android:icon="@drawable/ic_launcher"

    android:label="@string/app_name"

    android:theme="@style/AppTheme" >

    <activity

        android:name="com.example.sqlitenew.MainActivity"

        android:label="@string/app_name" >

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />


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

        </intent-filter>

    </activity>

</application>

Every tags in XML must inside a root tag and all tags must be closed perfectly. Otherwise it throws the error: The error Parser Exception : The markup in the document preceding the root element must be well formed states that the element inside the root tag is not closed properly.

Your XML should be in the format

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"
    android:versionCode="1"
    android:versionName="1.0" >
    <application>
        <!-- activities declaration -->
    </application>
</manifest>

Are you interchanging the project files between two operating systems? The same error came for me when I was working on linux and my project partner on windows. Try to do ctrl+shift+F in the XML file. it worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM