HOWTO Use Google Play Services C++ SDK Version 3+ with CodeWorks 1R8

Hey all, I needed to update my game to use the latest versions of Android CodeWorks, Google Play Games and Visual Studio. A lot has changed since my original post from April 2016:

The good news is that it’s much simpler now. That said, here is the updated procedure I had to do in order to get my game to use GPG Native SDK Version 3.1.0 (currently the latest) and Android CodeWorks 1R8.

If this is your first time setting up GPG in your project, you will need to do some setup in the Android Developer Console first. Follow this guide:
https://developers.google.com/games/services/cpp/GettingStartedNativeClient

Then…

  1. Download the GPG-CPP-SDK version 3.1.0, unzip it with the rest of the libraries in your project and setup the include and library paths as you would normally and add the library to your project as gpg only (not libgpg!)
    https://developers.google.com/games/services/downloads/gpg-cpp-sdk.v3.1.0.zip

  2. Under the Gradle Build->Additional Dependencies section, you’ll want to set it as:
    Maven Local Repositories: https://maven.google.com
    AAR Maven Dependencies: com.google.android.gms:play-services-games:19.0.0;com.google.android.gms:play-services-nearby:17.0.0

  3. Inside your AndroidManifest.xml you will need to have these meta-data tags inside the Application tags NOT the Activity tags!

<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

The app_id is your unique Google Play Service ID and should be set in an .XML file in your res/values directory. The file I THINK can be anything. People use game-ids.xml. Mine is just ids.xml. The contents should look something like this:

<?xml version="1.0" encoding="utf-8"?>

<resources>
  <string name="app_id"> Put your App ID number here </string>
</resources>

… and that’s it! The Gradle build system takes care of downloading and including everything needed which is nice.

Now if you were like me and had things setup following my previous guide of 2016, then you’ll have to remove the references to the JAR directories and the android-support-v4.jar.

This is what my Gradle Build->Additional Dependencies section looks like now:

From there, your code should just work. Good luck!

Fredy of Hardline Studios

1 Like

Thanks for sharing!