playgameservices / cpp-android-basic-samples

Sample games using the Google Play Games C++ SDK
302 stars 133 forks source link

Where should ./gpg-cpp-sdk directory be located? #28

Closed S3riousSam closed 8 years ago

S3riousSam commented 8 years ago

The How-to run a sample says that the developper must download the Google Play Game Services C++ SDK and unzip it to the ./gpg-cpp-sdk directory.

I'm sorry that I cannot figure out where that folder should go...

Thanks for clarifying this instruction for me.

claywilkinson commented 8 years ago

The instructions for a command line build are in README.build - it says that NDK_MODULE_PATH should be set to the location that the SDK was expanded. I suggest in Common/gpg-sdk.

You can also try to use the experimental Android Studio support to build with Gradle: http://tools.android.com/tech-docs/android-ndk-preview

S3riousSam commented 8 years ago

"NDK_MODULE_PATH to the location of the Play Games cpp libraries."... I understand this refers to the root of the cpp-android-basic-samples zip content, right?

claywilkinson commented 8 years ago

NDK_MODULE_PATH should be the directory that the C++ SDK was unzipped into.

S3riousSam commented 8 years ago

In build_sample.sh, "${ANDROID_HOME}/tools/android"... "android" refers to android.bat of the [Android SDK]\tools folder, right? (the build.sh scripts complains that I have ANDROID_HOME wrong (ERROR: F:\Android\ADT\SDK\tools\android does not exist), but android.bat exists there...

claywilkinson commented 8 years ago

Might be a windows vs. non-windows issue. can you try copying android.bat to android and see if still works? I'll look into later today for a more permanent solution.

S3riousSam commented 8 years ago

Likely Windows... so I guess it was not tested on Windows?

I had to make these changes to make the script building (however, it looks like it still does not produce any lib nor apk yet):

declare -r required_paths=( \
  "${ANDROID_HOME}/tools" \

declare -r android_tool="${ANDROID_HOME}/tools/android.bat"

output from build.sh:

Building... /bin/sh: mount : command not found /bin/sh: tr : command not found /bin/sh: awk : command not found

claywilkinson commented 8 years ago

Ugh - it does look the script is not windows friendly. I'll take a look as soon as I can.

claywilkinson commented 8 years ago

Did you get this working?

S3riousSam commented 8 years ago

Using Android Studio, yes. That was not an issue building it (after MANY guesses & try), but the sample application was crashing with UnsatisfiedLinkError exception (library not found)... which led me to try all kind of workarounds. At last I had to modify ButtonClickerNativeActivity.java to make it work...

gguuss commented 8 years ago

The following worked for me:

Build all samples on Windows using Gradle

  1. Unzip the Play Games Services to the sample folder. The gpg-cpp-sdk folder should be in the same folder containing the samples-android folder.
  2. Install Android Studio
  3. Set the path to the Android SDK

    set ANDROID_HOME=C:\Users\AppData\Local\Android\sdk

  4. Add the SDK to your path

    set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

  5. Set the path to the Android NDK

    set ANDROID_NDK_HOME=C:\Users\Desktop\android-ndk-r10e

  6. (Optional) On some versions of Windows it is helpful to map the samples folder to a shortened path.

    subst C: G:

  7. Execute the build script

    G: gradlew.bat sync gradlew.bat assemble