A required meta-data tag in your app's AndroidManifest.xml does not exist.

I am developing a google maps app for android.

But, somehow my application crashes giving an error like :

java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  

This is what my AndroidManifest.xml looks like:-

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
  <permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>

  <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.locations.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>

          <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyAZhJllASbTnrFta8hj55shKydSi0ks824"/>

    </application>

</manifest>

Log:-

01-09 12:29:35.249: E/AndroidRuntime(7448): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

I am using google maps for this app How can i resolve this?


Solution 1:

Missing the below in application tag of manifest. This ia new requirement as of updated google play services.

Check the topic Add the Google Play services version to your app's manifest @

https://developers.google.com/maps/documentation/android/start

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

Remove this

<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>

not required

Solution 2:

Google Map V2 add new feature in AndroidManifest.xml. You will need to add this metatag within application tag

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

Solution 3:

The Google Maps getting started https://developers.google.com/maps/documentation/android/start

guide says:

Add the Google Play services version to your app's manifest

Edit your application's AndroidManifest.xml file, and add the following declaration within the element. This embeds the version of Google Play services that the app was compiled with.

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

Solution 4:

Try to add following meta-data tag on Manifest file it's working fine.

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

Solution 5:

As Google Map V2 use use Google Play services you need to keep it updated. Latest google play services requires a version name, which is to be mentioned using <meta-data .. /> inside AndroidManifest.xml. This can be solved by both of the below ways_

1. Add following meta-data inside application tag of your AndroidManifest.xml

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

this value is there in your Google Play services library(res -> values -> version.xml)

2. Directly add the version code like

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

4030500 is version code which is stored inside

google-play-services_lib>res>values>version.xml

Like

<integer name="google_play_services_version">4030500</integer>