0

When I try to compile my app, xml pops up an error saying: "error: Error parsing XML: not well-formed (invalid token)". Here's my xml code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    uses-sdk android:minSdkVersion="7"  android:targetSdkVersion="18"
    package="com.example.app1"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.AppCompat.Light" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".DisplayMessageActivity"
            android:label="@string/title_activity_display_message"
            android:parentActivityName="com.example.myfirstapp.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.myfirstapp.MainActivity" />
        </activity>
    </application>
</manifest>

I tried to remove the compatibility line in my xml, the tags are also closed properly. I used that command because i set compatibility for android 2.2 or higher. If I choose to run for 3.0 and above will it work properly?

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94

5 Answers5

1

main problem is parent activity concept appy after api level 16 and your minimumapi level is 8 so remove

android:parentActivityName="com.example.myfirstapp.MainActivity" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.myfirstapp.MainActivity" />

and use its alternate..

Jayesh Khasatiya
  • 2,140
  • 1
  • 14
  • 15
  • Can you detail it please, it's my third day working with android and I am still accomodating with it. – Octavian Țițeică Aug 01 '14 at 09:02
  • i think you have refer below link for information: http://developer.android.com/training/basics/firstapp/starting-activity.html and http://developer.android.com/training/implementing-navigation/ancestral.html – Jayesh Khasatiya Aug 01 '14 at 09:08
  • ans check here below api 11:http://stackoverflow.com/questions/18610722/how-to-navigate-to-a-parent-activity – Jayesh Khasatiya Aug 01 '14 at 09:09
0

remove

uses-sdk android:minSdkVersion="7" and android:targetSdkVersion="18"

from the manifest tag

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
0

Add the tag in the end. Remove uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18" from starting manifest tag

And

Replace

<activity
    android:name=".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>

with

<activity
    android:name=".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>

You are missing > for activity tag

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
0
uses-sdk android:minSdkVersion="7"  android:targetSdkVersion="18"

try to remove this line from manifest tag and try to compile and even you place twice......

vinay Maneti
  • 1,447
  • 1
  • 23
  • 31
0

just remove this line from your manifest

uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18"

Gautam
  • 3,252
  • 3
  • 23
  • 32