Set up Google Play services

  • To develop apps using Google Play services APIs, set up your project with relevant SDKs from the Google maven repository and test on a compatible Android device or emulator.

  • To use Google Play services APIs, you need to declare the required SDK dependencies in your app's module-level build.gradle file.

  • You should check for the presence of Google Play services on a device using the isGooglePlayServicesAvailable() method before attempting to use Google APIs, as devices without the Google Play Store do not have it installed.

  • New versions of Google Play services SDKs are released periodically with updates and bug fixes, and updating your dependencies allows you to benefit from these improvements.

  • Google Play services also includes several Gradle plugins that can be included in your project for various use cases.

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

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

  • A compatible Android device that runs Android 7.0 (API level 24) 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 7.0 (API level 24) 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 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: