HOWTO Use Google Play Services C++ SDK with nSight Tegra

It took me a little while to get this working so hopefully I can save you some time with this little howto.

  1. Launch the Android SDK Manager and ensure you have installed the SDK platform for API 21 (Android 5.0) as well as the Google Play Services SDK way down the list in the extras section.

1.1) You will need to adjust your project’s Target Android API Level to 21. This helps avoid some little gotchas with getting this to work. You can keep the Min Android API Leve to whatever.

1.2) You’ll also need to get the C++ SDK from here:

  1. Next go to where your Android SDK is installed and into the extras\google\google_play_services\libproject directory and copy the google-play-services_lib directory over to where your Android project file is.

This should be the same directory where you have your res, assets, jar, src and other directories. At the root of that directory should be your project file as well as a file which is used by ANT.

  1. Open a command window in that directory by holding shift and right clicking in that directory while in explorer. You should see an “open command window here…” in the drop down menu. You’ll also need to ensure that the android tools directory is in your path because you’ll need it next!

3.1) First we need to import the google play library into our project so in the command window, issue this line:
android update project --library .\google-play-services_lib -p .

This will update the file and you should see something like this in there once the operation completes:

  1. Next we need to update the google play services lib itself so move into the google-play-services_lib directory and then execute this:
    android update lib-project -p . -t 6

So this preps it for being built and sets the API level to 21 (which is what level 6 is here).

  1. Unzip the GPG C++ SDK somewhere useful and then in your Visual Studio project settings under C++ -> General, you’ll need to point the project include path to the GPG SDK include directory.

5.1) Add the path to the GPG library in Linker -> General AND reference the actual library in Linker -> Input. Remember to just reference it as gpg as opposed to libgpg.a.

  1. Finally, still in the projects settings, in Ant Build\Additional Dependencies you will have to specify the JAR directories to point to where your (Android SDK is installed)\extras\android\support\v4 and in the JAR Dependencies section add android-support-v4.jar

6.1) An easier thing to do is have a jar directory off the root of where your Android project file is and throw in all the JAR’s you need in there. For my project I have several so makes it easy to keep them in once place!

From there, you should be ready to roll!

It’s great to share you experience here to help others.


Thanks for adding this information, quick question - what NDK version where you using during this process?


You can use NDK-r12b which is default ndk for the latest NSight Tegra.


I used NDK-10 but it should work with any future ones!

Thanks again so much for this guide, it is the only useful guide for this on the internet! To that end I wanted to just add a few points on that I found that I got snagged on.

These tags, must be placed in your projects AndroidManifest.xml within the tags, do not put them like I did, within the tags which is a child of the tag.


<meta-data android:name="" android:value="@string/app_id" />
<meta-data android:name="" android:value="@integer/google_play_services_version" />


You also need to add a game-ids.xml to your res/values folder - you can actually download this from the Google Play Developer Console, if you look at the achievements tab there should be a link at the bottom of your list called “Get Resources”, this should generate your game-ids XML file for you.

<?xml version="1.0" encoding="utf-8"?>
Google Play game services IDs.
Save this file as res/values/games-ids.xml in your project.
	<string name="app_id">12345</string>
	<string name="package_name"></string>
	<string name="achievement_1">crazyNumbers1234</string>

I can confirm this worked for me on NDK-r12b as well.

Nice! Perfect addendum!

Is this still valid?

“1) Launch the Android SDK Manager” The SDK Manager doesn’t exist anymore. So how do we selectively download this? The NVidia chooser.exe doesn’t allow such granularity.

To install only Android SDK’s platform 21 packages:

  1. Launch CodeWorks installer or ‘Chooser.exe’ directly
  2. In the opened window, Click ‘Clear Actions’
  3. Select ‘install’ for the 'Action' column for Android 5.0.1(API 21)
  4. Click ‘Next’, then Click ‘Keep&Apply’ in the pop-up dialog.
  5. Continue installation process.

Hope that helps, stevieboy

  1. Unzip the GPG C++ SDK somewhere useful and then in your Visual Studio project settings under C++ -> General, you’ll need to point the project include path to the GPG SDK include directory.