3

I have been developing a simple app for load a map view. I have followed the API. https://developers.google.com/maps/documentation/android/start#add_a_map

BUT

after the execution app goes force close and a LOGCAT ERROR The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. this is my manifest

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

<uses-sdk
    android:minSdkVersion="12"
    android:targetSdkVersion="13" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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"/>

<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.maps.v2.API_KEY"
        android:value="AIzaSyA5QozHkGwJP_9iJi7jtBV938T1wws02gA" />

    <activity
        android:name="com.example.newgmaps.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.gms.version" android:value="@integer/google_play_services_version" />
</application>

this is my main xml

<?xml version="1.0" encoding="utf-8"?>

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.google.android.gms.maps.MapFragment"/>

and this is main activity

package com.example.newgmaps;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

Shoot Sahan
  • 163
  • 1
  • 4
  • 9

7 Answers7

3

Do these 2 steps and let me know please

1st update your Google play services as show here enter image description here

2nd try out this new manifest file that i have created for you

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="11" />

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

    <uses-permission android:name="icom.example.newgmaps.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <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" />

    <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="4030500" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyA5QozHkGwJP_9iJi7jtBV938T1wws02gA" />

        <activity
            android:name="com.example.newgmaps.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>
    </application>

</manifest>

let me know if you solved this problem also Thank you

Community
  • 1
  • 1
Girish Nair
  • 5,148
  • 5
  • 40
  • 61
2

Use the previous version of Google Play Services libproject for now. It can be downloaded from here: https://dl-ssl.google.com/android/repository/google_play_services_3225130_r10.zip

Worked for me.

You can then update this later when Google makes the latest version available to everyone but something tells me it will be a while before this change propagates to all the devices out there.

iamronak
  • 626
  • 6
  • 14
1

I have the same problem when running the app on my 2012 N7 running 4.3.

I don't think the actual released version of Play Services matches the SDK version in version.xml:

google_play_services_version 4030500

So it's either a case of waiting for a Play Services update on Play Store, or possibly try changing the version.xml in google-play-services_lib.

benka
  • 4,732
  • 35
  • 47
  • 58
meavydev
  • 81
  • 1
  • 2
  • Forget to say - this was after adding the metadata line to the manifest. – meavydev Nov 01 '13 at 10:55
  • Just tried editing the version.xml and it didn't work - it requires 4030500, so it's a case of waiting for Play Store update or reverting to the previous services_lib version. – meavydev Nov 01 '13 at 11:02
  • yeah of course same problem here. I guess have to wait.. anyway keep in touch.. thank you – Shoot Sahan Nov 01 '13 at 11:15
  • If you don't want to wait for the update of Google Play Services in the Play Store, grab the APK of Play Services 4.0 from one of the latest dumps: http://www.droid-life.com/2013/10/31/download-new-google-apps-from-the-nexus-5-dump-search-launcher-and-more/ (first download) – saschoar Nov 01 '13 at 11:39
1

If you start the Android SDK manager you should see a "Google play services for Froyo" module. Install and use this instead of the "new" version. This worked for me.

Tim
  • 5,767
  • 9
  • 45
  • 60
1

Google must update Google play services to version 4.xxx enter image description here

Raul
  • 61
  • 6
1

I added this below xml code in "AndroidManifest.xml"

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

The crash error was disappeared. But when I call...

int iErrorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

"iErrorCode" is 2. 2 means like this

public static final int SERVICE_VERSION_UPDATE_REQUIRED The installed version of Google Play services is out of date. The calling activity should pass this error code to getErrorDialog(int, Activity, int) to get a localized error dialog that will resolve the error when shown. Constant Value: 2 (0x00000002) Details...

And also LogCat said...

W/GooglePlayServicesUtil(4728): Google Play services out of date. Requires 4030500 but found 3266136

Where is version code "4030500"??

[SDK]\extras\google\google_play_services\libproject\google-play-services_lib\res\values

You can see "version.xml". Open it!

<?xml version="1.0" encoding="utf-8"?> <resources>
    <integer name="google_play_services_version">4030500</integer>
</resources>

Peekaboo~~! :) This is why we got this errorCode(2) when update new SDK and use new "google-play-services-lib".

Okay! Got it! Let's check my Google Play Version on my device.

enter image description here

The version on my phone is "4.4.21" There is no problem I think. What is this "3266136"? Where were this from? I cannot understand this.

If I figure this out, I will update this long answer.

Good luck! Everybody! :)

Updated 1: I downloaded apk 4.4.22 and installed on my phone. But, LogCat still show me "3266136". This is really odd thing. I think Google-Team have to fix it ASAP!!

4.4.22 Download here...

Updated 2: After all, I decided to down-grade "google-play-services_lib" and "android-support-v4.jar" to previous version. I will be wait for them. :)

cmcromance
  • 2,289
  • 1
  • 25
  • 26
  • @ShootSahan Google updated their "play service lib" last week. So, this problem was solved. I tested lib and works well. See this : http://android-developers.blogspot.kr/2014/01/google-play-services-41.html – cmcromance Jan 13 '14 at 05:32
0

try to add this meta-data tag in the application tag in the Manifest :

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Abdel
  • 1,005
  • 2
  • 11
  • 24