michaelsmith
michaelsmith

Reputation: 1051

google_play_services meta-data not found, but it is there

I think I have my AndroidManifest.xml right, but when I launch app, it crashes with:

java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 0. You must have the following declaration within the element:

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

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />  
<uses-permission android:name="com.mytaxicontrol.permission.MAPS_RECEIVE" />
<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-permission android:name="com.android.vending.BILLING" />

Upvotes: 0

Views: 1551

Answers (3)

Yassin
Yassin

Reputation: 1386

Important: This error could come from duplicated definition of "google_play_services_version" You can verify by effecting a search for "google_play_services_version" on *.xml files. Be sure to delete all the definition of "google_play_services_version" on project's xml files.

Upvotes: 0

alicanbatur
alicanbatur

Reputation: 2200

meta datas should be inside the Application tag in manifest file.

 <application 
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:name="MyApplication"
        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"
            android:hardwareAccelerated="true"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize" />
</application>

Upvotes: 2

Raghunandan
Raghunandan

Reputation: 133560

This

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
     >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />  
... // rest of the code
</application>

must be a child of application tag in manifest.

Also make sure you have the 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#getting_the_google_maps_android_api_v2

Upvotes: 0

Related Questions