0
votes

I'm developing an Android game using Google Play Services to enable leaderboards and achievement in my game. I'm using Android Studio and Gradle to build my application.

I have two problems (which are strongly related) :

Problem 1 : Unable to use the play services on phone

First, when i launch the application on my devices (Samsung GS4, with Android 4.4 and/or Samsung Galaxy Tab S, also with Android 4.4), i run into this problem :

enter image description here

This appears immediatly after calling Google Play Service functionalities in the game main menu.

Google Play services are already updated to the latest version on my device. They aren't blocked either, as they are working in other games i downloaded from the Play Store.

To build my app, i'm also using the latest version of the android gms play services as recommended here. I do have the required dependencies in my gradle build file.

compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:5.+'

Problem 2 : Unable to upload to the play store

I decided to upload the signed apk on the Play Store as an alpha build using the Google Play developer console. However, the file won't even be uploaded because of the Play Service version i'm using.

enter image description here

NB : I wasn't able to get an english version of this message, even after changing browser and system settings, so here is a translation :

Import a new alpha apk file

You have imported an apk file using version 5208000 of Google Play Services. You must use version 5100000 or earlier

So, it seems like i'm using a too recent version of Google Play Service... I'm pretty confused, as all ressources i've been browsing lately recommended to use the latest versions.

What could be the source of this problem ?

1

1 Answers

3
votes

Google gives you a more modern version of Google play services to develop with than is allowed on the marketplace. Try changing the line in your gradle file to this:

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

That's a version of play-services that is allowed on the marketplace. Then make sure your manifest file has this:

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

Where android:value is that exact variable name rather than a number. Here is where I found my answer.