25

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?

user3146095
  • 419
  • 2
  • 7
  • 25
  • Follow these instructions: https://developer.android.com/google/play-services/setup.html. You need to add: As as child of the element! – IgorGanapolsky Jan 16 '14 at 19:42

8 Answers8

64

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

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
10

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" />
Satyaki Mukherjee
  • 2,857
  • 1
  • 22
  • 26
6

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" />
Thirumoorthy
  • 589
  • 2
  • 11
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>
Rupesh Yadav
  • 12,096
  • 4
  • 53
  • 70
  • I using first method and it is working fine. I also cross checked my version from @integer/google_play_services_version and getting the desired result. But it is still crashing for some users on production. Any input on this ? – Adarsh Yadav Mar 16 '20 at 12:14
2

Try cleaning your project (select project>project tab>clean)

I solved my problem with this. Cleaning is the solution for most problems.

Ozan Atmar
  • 270
  • 1
  • 3
  • 11
1

There is no need for permission:

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

A tag including the google services might do the trick.

Murmel
  • 5,402
  • 47
  • 53
Taps
  • 61
  • 1
  • 8
0

If you update your google play services you need to update your res/values tag too.

Renato Probst
  • 5,914
  • 2
  • 42
  • 45
0

you have to add this line

 <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
in AndroidManifest.xml  <application>
Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171