Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : Top level element is not completed in AndroidManifest.xml

Tags:

android

xml

I have a problem when i'm trying to use Google Play Services in my app. I followed this tutorial https://developers.google.com/maps/documentation/android/start but i have an error after i put this line into my AndroidManifest.xml :

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

On the android:name line, error is : "Top level element is not completed, Valid XML document must have a root tag". But, my XML file is valid without the meta-data line.

My AndroidManifest.xml starts like that :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.objectifmultimedia.chasseursbn">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <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>
    <activity
        android:name=".TutorielActivity"
        android:label="@string/title_activity_tutoriel" >
    </activity>
    <activity
        android:name=".Departements.DepartementActivity"
        android:label="@string/title_activity_departement" >
    </activity>
    <activity
        android:name=".Departements.DepartementActualitesActivity"
        android:label="@string/title_activity_departement_actualites" >
    </activity>
    <activity
        android:name=".Departements.DepartementPermisDeChasserActivity"
        android:label="@string/title_activity_departement_permis_de_chasser" >
    </activity>
    <activity
        android:name=".Departements.DepartementDatesOuverturesActivity"
        android:label="@string/title_activity_departement_dates_ouvertures" >
    </activity>
    <activity
        android:name=".Departements.DepartementEspacePersonnelActivity"
        android:label="@string/title_activity_departement_espace_personnel" >
    </activity>
    <activity
        android:name=".Departements.DepartementAnnuairesActivity"
        android:label="@string/title_activity_departement_annuaires" >
    </activity>
    <activity
        android:name=".Departements.DepartementMeteoEphemerideActivity"
        android:label="@string/title_activity_departement_meteo_ephemeride" >
    </activity>
    <activity
        android:name=".Departements.DepartementCommunesLimitrophesActivity"
        android:label="@string/title_activity_departement_communes_limitrophes" >
    </activity>
    <activity
        android:name=".Aide.AideActivity"
        android:label="@string/title_activity_aide" >
    </activity>
    <activity
        android:name=".PendantMaChasse.PendantMaChasseActivity"
        android:label="@string/title_activity_pendant_ma_chasse" >
    </activity>
    <activity
        android:name=".Departements.DepartementActualitesDetailActivity"
        android:label="@string/title_activity_departement_actualites_detail" >
    </activity>
    <activity
        android:name=".Departements.DepartementDatesOuverturesDetailActivity"
        android:label="@string/title_activity_departement_dates_ouvertures_detail" >
    </activity>
    <activity
        android:name=".PendantMaChasse.PendantMaChasseMapActivity"
        android:label="@string/title_activity_pendant_ma_chasse_map"
        android:theme="@android:style/Theme.NoTitleBar">
    </activity>
    <activity
        android:name=".PendantMaChasse.PendantMaChasseDatesActivity"
        android:label="@string/title_activity_pendant_ma_chasse_dates" >
    </activity>
</application>

</manifest>

Thanks. Yann

like image 687
Yann Gallis Avatar asked Sep 29 '14 12:09

Yann Gallis


1 Answers

3 easy steps:

  1. Select element in xml that displays error.
  2. Press alt + enter on the drawable item which calls error (for example: "@drawable/example").
  3. And select "Uninject language/reference"

hope this might help

like image 189
CommonSenseCode Avatar answered Oct 02 '22 06:10

CommonSenseCode