Following the deprecation of the
[Google Sign-In](https://android-developers.googleblog.com/2024/09/streamlining-android-authentication-credential-manager-replaces-legacy-apis.html)
API, we are removing the games v1 SDK in 2026. After February 2025, you will be unable to publish
titles that are newly integrated with games v1 SDK, on Google Play. We recommend that you use the
games v2 SDK instead.  

While existing titles with the previous games v1 integrations continue to function for a
couple of years, you are encouraged to
[migrate to v2](https://developer.android.com/games/pgs/android/migrate-to-v2)
starting June 2025.  

This guide is for using the Play Games Services v1 SDK. The C++ SDK for
Play Games Services v2 is not yet available.

This developer guide will show you how to compile and run a C++ game on Android that uses the Google Play
Game services API. Before you begin, download and configure the following requirements:

- [Android NDK](https://developer.android.com/ndk), Revision 14 or higher.
- [Android SDK v10 or higher and latest version of the Eclipse ADT](https://developer.android.com/studio/tools/sdk/eclipse-adt).
- Device must be running Android 4.0 (API level 14) or higher.
- [The latest version of the Google Play services SDK.](https://developers.google.com/android/guides/setup)

This developer guide uses the Android Native Development Kit (NDK). If you are unfamiliar with the NDK,
refer to the [NDK documentation and samples](https://developer.android.com/ndk)
before continuing.

## Step 1: Set up your environment

1. Download the Android SDK and the Android NDK and extract them to your machine. In your environment, set `SDK_ROOT` to the location of your Android SDK folder and `NDK_ROOT` to the location of your Android NDK folder.
2. Download the [C++ sample games](https://github.com/playgameservices/cpp-android-basic-samples). This developer guide refers to the location of the samples on your machine as `SAMPLES_DIR`.
3. Download the [Google Play Games services C++ SDK](https://developer.android.com/games/pgs/downloads#sdk). Extract the SDK onto your development machine. In your environment, set the variable `NDK_MODULE_PATH` to point to the directory **above** the `gpg-cpp-sdk` directory. You should have the following directory structure:  

   ```
   NDK_MODULE_PATH/
   gpg-cpp-sdk/
   ```
4. Open Eclipse. If you have not already done so, tell Eclipse where you installed the NDK by clicking **Preferences \> Android \> NDK**.
5. Import the Google Play services library project into your Eclipse workspace.

   1. In Eclipse, click **File \> Import \> Android \> Existing Android Code into Workspace**.
   2. Select `SDK_ROOT/extras/google/google_play_services/libproject/google-play-services_lib` where `SDK_ROOT` is the location of your Android SDK.
   3. Click **Finish**.
6. Import the minimalist sample project into your Eclipse workspace.

   1. In Eclipse, click **File \> Import \> Android \> Existing Android Code into Workspace**.
   2. Select `SAMPLES_DIR/samples-android/minimalist`.
   3. Click **Finish**.
7. Right click the MinimalistActivity project and click **Properties** . Under **Android** , scroll
   down to the **Library** section and make sure the google-play-services_lib project is correctly
   referenced. If not, remove the reference and add it again from your workspace.

Eclipse will automatically compile the Java and Android sources of your project; however, the
native code in the `jni` folder needs to be compiled separately. To do this manually, navigate to
the `jni` folder and run `ndk-build`. Remember to do this after you make any changes inside
the `jni` folder.

Your project should now compile, though it will not work yet. You must first configure your game
in the Google Play Console.

## Step 2: Set up the game in the Google Play Console

Create an entry for your game in the Google Play Console. This enables Games services for your
application, and creates an OAuth 2.0 client ID, if you don't already have one.

1. Create an entry for your game by following the steps described in [Setting Up Google Play Games Services](https://developer.android.com/games/pgs/console/setup).
2. In `AndroidManifest.xml`, change the `package` attribute of the `<manifest>` tag to the package name you chose when setting up the Google Play Console. You may have to fix some references throughout the project after making this change (particularly to the generated `R` class).
3. Open `res/values/ids.xml` and place your App ID there. Note that the App ID is not the same as the client ID; it is the number next to the name of your game in the **Game Details** page of the Google Play Console.

## Step 3: Run the sample

In order to run the sample you will need a physical Android device or an emulator with
Google Play services installed:

1. Run `ndk-build` to compile the native code.
2. In Eclipse, click **Run \> Run As \> Android Application** and run the sample on your device.
3. When the sample opens, tap anywhere on the screen. You should see a Google Play Games logo appear. If you have correctly configured your app, you will be prompted to sign in.

| **Important:** Make sure to sign your APK with the same certificate as the one whose fingerprint you configured on Google Play Console. Failure to do so will produce errors.
| **Important:** If you are testing an unpublished game, make sure that the account with which you intend to sign in (usually, the account on the test device) is listed as a tester in the project. Open the **Testing** page, in the **Game services** subtab of the Google Play Console, to check or perform whitelisting. Failure to perform this step causes the server to act as though your project does not exist, and return errors.

## Optional: Build automatically with Eclipse

The following steps show you how to configure Eclipse to automatically run `ndk-build` when you
make changes to files in the `jni` folder.

1. Right-click the MinimalistActivity project and click **Properties** . In the Properties window, select the **Builders** pane.
2. Click **New** to add a new Builder and select **Program** then click **OK**.
3. In the **Name** field, enter 'NDK Builder'.
4. Under **Location** click **Browse File System** and navigate to the `NDK_ROOT` directory and select the `ndk-build` command.
5. Under **Working Directory** click **Browse Workspace** and select the MinimalistActivity project folder.
6. Click the **Refresh** tab. Make sure the **Refresh resources upon completion** box is checked.
7. Select the **Specific resources** radio button and then click **Specify Resources** . In the resulting dialog, select the `jni` folder under MinimalActivity.
8. Click **Apply** and then **OK** to finish creating your Builder.

Now every time you edit a file within the `jni` folder, Eclipse will run `ndk-build` and print the
output to the Eclipse Console.
| **Note:** If you see errors when editing C or C++ files in Eclipse that prevent you from building the project, you may want to disable C/C++ error reporting in Eclipse. In your project properties, navigate to **C/C++ General \> Code Analysis \> Launching** and make sure that both boxes are unchecked. Then click **Apply** and **OK** . This is a workaround to prevent Eclipse from checking your native code, it does **not** fix any real underlying errors you may have.