Swann Polydor Swann Polydor - 4 months ago 27
Android Question

android google play service out of date

I am trying to add a Google Map in my activity (I already done it) and whenever I go on the activity I got a message saying that I need to update my Google play's services (obviously they are)

Also I am using a real device I am not emulating anything.

Here is my AndroidManifest

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<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" >
<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=".AdministrationActivity"
android:label="@string/title_activity_administration" >
</activity>
<activity
android:name=".GroupActivity"
android:label="@string/title_activity_group" >
</activity>
<activity
android:name=".NewsActivity"
android:label="@string/title_activity_news" >
</activity>
<activity
android:name=".DiderotActivity"
android:label="@string/title_activity_diderot" >
</activity>
<activity
android:name=".MapActivity"
android:label="@string/title_activity_map" >
</activity>
<activity
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar"
android:name=".CameraActivity"
android:label="@string/title_activity_camera" >
</activity>

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

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

</manifest>


Here is my activity's xml file :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.soueuls.swipe.MapActivity">

<fragment
android:id="@+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>


Here is my activity file :

package com.example.soueuls.swipe;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

public class MapActivity extends ActionBarActivity {


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

GoogleMap map = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
BaseMenuHandler.onCreateOptionsMenu(menu, this);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
BaseMenuHandler.onOptionItemSelected(item, this);
return super.onOptionsItemSelected(item);
}
}


Any idea ?

Answer

I resolved the problem myself.

It seems that the latest "Google play service" though my IDE was not good to publish apps and use API. I had to replace inside the local build gradle file:

compile 'com.google.android.gms:play-services:+'

by:

compile 'com.google.android.gms:play-services:5.0.89'