49

I'm working on an android project which requires the use of google maps. I've been reading tutorials, and I have to add this to the AndroidManifest.xml file:

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

The thing is, I don't know what number to substitute the "@integer/google_play_services_version" with.

If anyone knows what I should enter there, and how to obtain that integer value, I'd appreciate it.

tshepang
  • 12,111
  • 21
  • 91
  • 136
user3184786
  • 501
  • 1
  • 4
  • 7

5 Answers5

54

There is no need to subsitute. The value @integer/google_play_services_version takes care of it. Just make sure you have the latest Google Play Services library which is updated.

You can find it under google-play-services_lib>res>values>version.xml if you wish to add the number rather than @integer/google_play_services_version.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="google_play_services_version">4030500</integer>
</resources>
elarcoiris
  • 1,914
  • 4
  • 28
  • 30
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • Thanks, that was useful; however, my map still doesn't show. lol – user3184786 Jan 26 '14 at 06:21
  • @user3184786 in which case you should post the relevant code or debug yourself. Your problem may not be related to this or may be altogether a different issue. lol :) – Raghunandan Jan 26 '14 at 06:22
15

Here is the official guide for setting up Google Play Services in your project.

FYI, you could find the version number in this folder:

~\android-studio\sdk\extras\google\m2repository\com\google\android\gms\play-services

Enjoy.

ahmed hamdy
  • 5,096
  • 1
  • 47
  • 58
Sam003
  • 540
  • 6
  • 17
7

Error you have mentioned is maybe because of not adding Google play services lib as library of your project do the following.

  1. Select File -> Import -> Android -> Existing Android Code Into Workspace and click Next.
  2. Select Browse, enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Open. 3.Select Copy projects into workspace and click Finish.

Mark Google Play services as a library: Right-click the google-play-services_lib project, and choose Properties > Android. Tick the Is Library option.

Right click on your project -> go to properties -> click android -> click add button -> click google_play_services_lib -> ok -> apply -> ok clean your project this will remove your error

Maryam
  • 109
  • 4
6

If you are using gradle just make sure you have the updated google play services version (downloaded using SDK manager) and put this in your project module dependency section:

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

IMPORTANT NOTE:
In general it is not a good practice to remove the concrete version of the source you are compiling against.

MikeL
  • 5,385
  • 42
  • 41
  • whence you resync with gradle android:value="@integer/google_play_services_version" /> will turn green – Ohiovr May 24 '15 at 15:39
1

I was in a case where I had to use the Froyo version of the Google Play Services, and that version doesn't require the tag. In fact, the XML entry google_play_services_version does not exist in the Froyo+ version of the Google Play Services library

Joe Plante
  • 6,308
  • 2
  • 30
  • 23