5

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

Yann Gallis
  • 51
  • 1
  • 1
  • 4

3 Answers3

21

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

Community
  • 1
  • 1
CommonSenseCode
  • 23,522
  • 33
  • 131
  • 186
0

Your manifest file is correct. try to things here.

1) Add required library into your project. If done!!

2) Clean(Go to Project Menubar > Click on Clean > Select project > Done) your project. This should solve your problem

AAnkit
  • 27,299
  • 12
  • 60
  • 71
  • I did it, but message is still there. I forgot to say that i'm on Android Studio. May it be a bug from the beta version ? Btw, app is lunching correctly on my device ... I don't understand why ... – Yann Gallis Sep 29 '14 at 12:41
0

Stupid error in my case Xml tag of sub parent is closed like this <Tag /> instead of <Tag> Some more tags </Tag>

pallav bohara
  • 6,199
  • 6
  • 24
  • 45