Google game services using gradle - android

Is there a way to add google game services in a simple way using gradle 0.5+ like how its possible with the support library or the google play services:
dependencies {
compile "com.android.support:support-v4:13.0.0"
compile 'com.google.android.gms:play-services:3.1.36'
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
}

Play Game Services is not a separate library from the Google Play Services library. It seems that you are using a very old version of play-services through. Try the newest version, which definitely has the Games API:
compile 'com.google.android.gms:play-services:6.5.87'

Related

How to compile only the needed Google Play Services' dependencies with Ant

Seems that with newer versions of Google Play you can compile only needed modules with gradle
with something like
dependencies {
compile 'com.google.android.gms:play-services-base:6.5.+'
compile 'com.google.android.gms:play-services-maps:6.5.+'
}
If I want to include only some dependencies (needed to analytics and in app billing services) without gradle using standard project.properties file, How could I achieve the same result?
This is not possible with what Google provides. Split dependencies are only supported with Gradle.

PlaceAutocompleteFragment can't resolved

In my app I have added Google Maps and they work fine. I want to add a PlaceAutocompleteFragment. I am using the key which I had already generate for maps and I have enable the option Places Api from google.console. I have added these to my build.gradle:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
but when I try to use PlacesAutoCompleteFragment then Android Studio can't resolve this.
The problem here is that PlaceAutocompleteFragment didn't exist in version 8.3 of Google Play Services.
This isn't documented very well, but you can see on this blog that PlaceAutocompleteFragment was "announced" in December 2015.
You can also see in the PlaceCompleteFragment Google code samples on GitHub that they are using version 8.4 of GooglePlayServices.
I also had this problem, and updating Google Play Services is what made it work.
So, update Google Play Services in the SDK Manager, and then modify the build.gradle like so, and it should work:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
Update
In newer versions of Google Play Services, they have broken out the Google Places API, so you need to include it in addition to Maps and Location:
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'

GooglePlayServices is not working with the project

I am working on a project where I have to authenticate a user with the Google plus and I did that. Now I have shifted my project from one PC to another for some reasons. I have made changes on developers console but when I try to login with google plus after launching, it says "Google Play Services not available. This application will close."
Why this error comes when everything is fine?
gradle dependencies is as follows:
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.code.gson:gson:1.7'
compile 'com.google.android.gms:play-services:+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
Make sure that the device (or the emulator) where you're running the app has Google Play Services installed with the latest version (currently at least 8.1.0), or set exact (earlier) version in your build.gradle.

which Google Play services API contains com.google.android.gms.appstate.AppStateManager?

I am using google play services API, and from old version of code, i included the whole library. Now i want to use Selectively compiling APIs from this link https://developers.google.com/android/guides/setup. But i can't find what does com.google.android.gms.appstate.AppStateManager come from .
I already have this
compile 'com.google.android.gms:play-services-base:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-games:7.5.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
but none of them have.
Please help.
The AppStateManager of the Google Play Services is DEPRECATED, so they have hidden the AppState play-services-dependency.
At the moment you can still get it via the following dependency, but it will probably get deleted soon.
compile 'com.google.android.gms:play-services-appstate:7.8.0'
or for Updated version use
implementation 'com.google.android.gms:play-services-appstate:8.4.0'
Add the following dependency in build.gradle rember this is for old DEPRECATED
compile 'com.google.android.gms:play-services-appstate:9.0.0'
This is work for me

What's the dependency for GcmTaskService (GCM)?

What dependency can I put in my build.gradle file so that I can use Google's GcmTaskService (and/or other GCM features)?
I would prefer to use the specific dependency and not to use the generic Google Play Services dependency: compile 'com.google.android.gms:play-services:7.5.0'
Found the answer I was looking for: compile 'com.google.android.gms:play-services-gcm:7.5.0'
Source that includes all the different specific Google Play Services packages: https://developers.google.com/android/guides/setup

Categories

Resources