16

Im trying to add google play API to my android game and i followed the instructions in their site.

I got this error in the emulator run, trying to solve it. (on my phone the app just crash)

In the manifest:

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

In the Version.xml

<integer name="google_play_services_version">7571000</integer>

and i got all the necessary packages installed.

What the problem may be?

Comment: it's installed

LamaTo
  • 540
  • 1
  • 8
  • 21
  • 2
    open the SDK manager on your machine and download the latest Google Play Services. – gsb Jun 10 '15 at 21:35
  • 4
    1) If you use ADK emulator you need to download latest Google APIs image which hopefully has latest Google Play services. Otherwise update Google Play services on your emulator/device via play store. 2) If you don't need latest APIs from Google Play services include an older version of the library in your project. – Eugen Pechanec Jun 10 '15 at 21:43
  • Please post your dependencies from build.gradle – Ido Naveh Jul 15 '15 at 12:37
  • Download lasted google play services. And be sure add lastest version of google play services on gradle script. – Metehan Toksoy Jul 15 '15 at 13:17
  • @LamaTo Did you happen to resolve this? I am getting this and even upgrading to latest sdk tools, etc didnt help.. – raksja Jul 21 '15 at 01:26
  • Actually i'm really glad or should i say sad to see that i'm not the only one that encounter this problem. I didn't solved it, i stoped trying to because i wasted too much time on it and needed to move on with other projects i had. So please, if someone that read this know how to solve our problem with a simple tutorial or guidance it will be very helpful. – LamaTo Jul 24 '15 at 09:36

5 Answers5

5

Add the below script in dependencies.gradle, it will download the latest play service lib automatically, and you can find them on local path such as: m2repository/com/google/android/gms/play-services.

dependencies {
  compile 'com.google.android.gms:play-services:4.2.+'
}
Quentin Hayot
  • 7,786
  • 6
  • 45
  • 62
Xue Jing
  • 76
  • 2
  • 2
    This works fine. I set mine to 6.+, but the idea is the same. The problem reported here and in http://stackoverflow.com/questions/18284874/service-version-update-required-and-google-play-service-out-of-date-while-integr is just that the build is being done against a version of google services that is newer than what is on the emulator. If you could update the emulator to a newer version, like a user would do, that would work, but you can't. So the alternative is to tell gradle to build against an earlier version of google services that is available on the emulator. – Jim Showalter Jul 25 '15 at 20:24
1

In my case I'm working with wearables and I must use the Google Play Services wearable library:

compile 'com.google.android.gms:play-services-wearable:7.5.0'

I was getting the message Google Play services out of date. Requires 7571000 but found 7327534 in the log.

And the watch suggested updating Android Wear and automatically run it on the phone. But Android Wear couldn't be updated since there were no more updates available, so in the end I changed the library version from 7.5.0 to 7.3.0 and it worked.

Juan José Melero Gómez
  • 2,742
  • 2
  • 19
  • 36
0

Google Play services needs to be listed as a dependency in the code (which you have done) and also on the device/ emulator that you are using.

When creating the virtual device, go to *AVD --> Create virtual device --> new hardware profile --> next --> select the image as per requirement. You should have an option of seeing the google play services version. If that isnt high enough then you probably dont have the images needed which can be downloaded from android SDK

EDIT : Sorry i meant to type AVD and not ADB. Android Virtual Device Manager is a mobile icon with some green circles below it located on top right corner. This is used to launch new emulators with select hardware settings. These settings are downloaded from the android SDK in form of system images under the different APIs

Varun Agarwal
  • 1,587
  • 14
  • 29
  • what do you mean by "go to ADB and go on additional hardware settings"? Where are those options located? – buc030 Aug 10 '15 at 12:45
  • 1
    To run this you need two things. 1) Proper declaration of google play services in the dependency and manifest, 2) The latest version of google play installed on your phone or the emulator. Phones can update for play services automatically but for the emulator you need to download a separate image file and specify the emulator to use it. – Varun Agarwal Aug 11 '15 at 16:56
0

I have found the solution which worked for me. Assuming that your are using the Google Maps V2 API you need to get the API Key from [https://code.google.com/apis/console/][1]

Make sure you have the following in Android Manifest.xml:

 <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyA7xyeYSyonpXb6cqrmrBOCmKGd8q6FOlI" />
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
Veeresh
  • 363
  • 3
  • 5
  • 9
0

Didn't specify what IDE you use?
- In case of gradle / Android studio you can check and configure in build.gradle file, setting 1, as described here, other settings are not necessary and can be removed.
- In case of other IDE / Eclipse check project references and correlate jar file from lib folder with @integer/google_play_services_version value from sdk project.
eclipse project properties

Check the following settings:

  1. in build.gradle

    dependencies {  
        compile 'com.google.android.gms:play-services-base:7.5.0@aar'  
    
  2. in AndroidManifest.xml, usually should add in your project manifest file

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    
  3. in res/values/version.xml from referenced sdk project or included in your own project manifest file

    <resources>
        <integer name="google_play_services_version">7571000</integer>
    </resources>
    

To find out what version can be used in build.gradle or to download specific version of google play services sdk , check here and here.

c-romeo
  • 388
  • 4
  • 13