Google is committed to advancing racial equity for Black communities. See how.

Set up Google Play services

To develop an app using Google Play services APIs, set up your project with the relevant SDKs, which are available from the Google maven repository.

For more detailed instructions, view the Android Studio page about how to update the SDK tools that your app project uses.

To test your app when using Google Play services, you must use one of the following:

  • A compatible Android device that runs Android 4.1 (API level 16) or higher and has the Google Play Store app installed.
  • The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 (API level 17) or higher.

Declare dependencies for Google Play services

To develop features that depend on the Google Play services APIs in your app, complete the following steps:

  1. Open the build.gradle file inside your app's module directory.

  2. For each SDK that your app requires, include the dependency for that SDK. This page includes a section that lists common Google Play services dependencies for Android apps. You might also want to add Firebase dependencies to your project.

  3. Save the changes and sync your project.

The following snippet shows an example build.gradle file that uses the location library:

apply plugin: 'com.android.application'

...

dependencies {
    implementation 'com.google.android.gms:play-services-location:18.0.0'
}

New versions of the Google Play services SDKs with bug fixes and new features are periodically released. These updates are announced in the release notes. If your app uses a dependency that has been updated, change to the latest version in your app's dependencies to take advantage of these fixes.

Check whether Google Play services is installed

As described in the Google Play services overview, Google Play services receives automatic updates on Android 4.1 (API level 16) and higher through the Google Play Store app. However, Android devices without Google Play Store don't have Google Play services installed. If your app runs on devices without Google Play services, you might want to check to see if Google Play services is installed on the device before you attempt to use Google APIs, or enable features in your app that require Google Play services to function.

To check for the presence of Google Play services on the device, use the isGooglePlayServicesAvailable() method.

To then begin a connection to Google Play services, or learn how to detect whether the version of Google Play services installed supports a specific API, read the guide on Accessing Google APIs.

List of Google Play services dependencies

Table 1 contains the set of dependencies powered by Google Play services, which you can include in your app:

Table 1. Google Play services dependencies to include in a build.gradle file, and the use cases that the dependencies fulfill.
Use case Dependency name
Google Mobile Ads com.google.android.gms:play-services-ads:20.1.0
Android Advertising ID (AAID) com.google.android.gms:play-services-ads-identifier:17.0.0
Lightweight version of Google Mobile Ads com.google.android.gms:play-services-ads-lite:20.1.0
AdSense for Search (AFS) Custom Search Ads (CSA) com.google.android.gms:play-services-afs-native:18.1.0
Google Analytics Services SDK for Android com.google.android.gms:play-services-analytics:17.0.0
Google Sign-In for Android com.google.android.gms:play-services-auth:19.0.0
SMS Retriever API com.google.android.gms:play-services-auth-api-phone:17.5.0
Google Awareness API com.google.android.gms:play-services-awareness:18.0.1
Utility classes com.google.android.gms:play-services-base:17.6.0
More utility classes com.google.android.gms:play-services-basement:17.6.0
Google Cast com.google.android.gms:play-services-cast:20.0.0
Google Cast Application Framework (CAF) com.google.android.gms:play-services-cast-framework:20.0.0
Android TV Receivers com.google.android.gms:play-services-cast-tv:18.0.0
Chromium network stack (Cronet) com.google.android.gms:play-services-cronet:17.0.0
Fast IDentity Online (FIDO) Authentication com.google.android.gms:play-services-fido:19.0.0-beta
Google Fit API for Android com.google.android.gms:play-services-fitness:20.0.0
Google Play Games Services for Android com.google.android.gms:play-services-games:21.0.0
Google Play Instant com.google.android.gms:play-services-instantapps:17.0.0
Fused Location Provider for Android (includes activity recognition and geofencing) com.google.android.gms:play-services-location:18.0.0
Google Maps SDK for Android com.google.android.gms:play-services-maps:17.0.1
ML Kit barcode scanning com.google.android.gms:play-services-mlkit-barcode-scanning:16.1.4
ML Kit face detection com.google.android.gms:play-services-mlkit-face-detection:16.1.3
ML Kit image labeling com.google.android.gms:play-services-mlkit-image-labeling:16.0.2
ML Kit text recognition com.google.android.gms:play-services-mlkit-text-recognition:16.1.3
Nearby device discovery and connection com.google.android.gms:play-services-nearby:17.0.0
Show open-source licenses com.google.android.gms:play-services-oss-licenses:17.0.0
Screen lock quality check com.google.android.gms:play-services-password-complexity:17.0.0
reCAPTCHA Enterprise for app instrumentation com.google.android.gms:play-services-recaptcha:16.0.0
SafetyNet APIs com.google.android.gms:play-services-safetynet:17.0.0
Google Tag Manager com.google.android.gms:play-services-tagmanager:17.0.0
Tasks API on Android com.google.android.gms:play-services-tasks:17.2.1
Mobile Vision com.google.android.gms:play-services-vision:20.1.3
Google Pay for Payments on Android com.google.android.gms:play-services-wallet:18.1.2
Wearable Data Layer API com.google.android.gms:play-services-wearable:17.1.0

Gradle plugins

Google Play services also includes several Gradle plugins, as shown in Table 2:

Table 2. List of Gradle plugins included in Google Play services.
Use case Gradle plugin name
Show open-source licenses com.google.android.gms:oss-licenses-plugin:0.10.4
Strict version checking com.google.android.gms:strict-version-matcher-plugin:1.2.2