After two years I created this question a lot of things has changed concerning Android Studio
and what you have to do to use the Google Play Services library
.
I think I can answer myself reporting the important steps of the official documentation which can be found here: https://developers.google.com/android/guides/setup
I also assume you already have installed an updated version of Android Studio
with the latest SDK Tools
.
So here is the procedure:
1 - Add the required SDK packages from the SDK Manager:
- Google Repository
- Google Play services
Official documentation can be found here: https://developer.android.com/sdk/installing/adding-packages.html
2 - Open the build.gradle
file inside your application module directory and add a new build rule under dependencies
for the latest version of play-services.
For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:7.5.0'
}
Be sure you update this version number each time Google Play services is updated.
3 - Save the changes and click Sync Project with Gradle Files in the toolbar.
From version 6.5, you can selectively compile Google Play service APIs into your app.
In the official documentation you can find the complete list of the individual APIs
and corresponding build.gradle
descriptions.
Package summary: https://developers.google.com/android/reference/com/google/android/gms/package-summary
When you create a new project, Android Studio also provides a Google Play Services Activity template.