Merge "Don't spam logcat after TuningFork is destroyed"
tree: e21d1051ebfe3e37051954eee632f6619f7a4f7f
  1. bender/
  2. cert/
  3. gradle/
  4. hooks/
  5. include/
  6. samples/
  7. src/
  8. test/
  9. third_party/
  10. .gitignore
  11. ab_info.py
  12. build.bat
  13. build.gradle
  14. build.sh
  15. download.sh
  16. gradle.properties
  17. gradlew
  18. gradlew.bat
  19. LICENSE
  20. OWNERS
  21. PREUPLOAD.cfg
  22. README.md
  23. RELEASE_NOTES
  24. settings.gradle
  25. THIRD_PARTY_NOTICES
README.md

Android Game SDK

Build the Game SDK

In order to build the Game SDK, this project must be initialized from a custom repo.

mkdir android-games-sdk
cd android-games-sdk
repo init -u https://android.googlesource.com/platform/manifest -b android-games-sdk

Build with locally installed SDK/NDK

If the Android SDK is already installed locally, then download only the Game SDK source and build tools (~500Mb).

repo sync -c -j8 gamesdk
repo sync -c -j8 prebuilts/cmake/linux-x86 external/modp_b64 external/googletest external/nanopb-c external/protobuf

Point the environment variable ANDROID_HOME to your local Android SDK (and ANDROID_NDK, if the ndk isn't in ANDROID_HOME/ndk-bundle). Use the following gradle tasks to build the Game SDK with or without Tuning Fork (default target is archiveZip).

cd gamesdk
./gradlew archiveZip # Without Tuning Fork
./gradlew archiveTfZip # With Tuning Fork

Build with specific prebuilt SDKs

Download the project along with specific versions of prebuilt Android SDK and NDK (~4GB). First, download the core project and tools

repo sync -c -j8 gamesdk
repo sync -c -j8 prebuilts/cmake/linux-x86 external/modp_b64 external/googletest external/nanopb-c external/protobuf

Next, use the download script to get prebuilt SDKs and/or NDKs.

cd gamesdk
./download.sh

Finally, build the Game SDK using downloaded prebuilts.

cd gamesdk
ANDROID_HOME=`pwd`/../prebuilts/sdk ANDROID_NDK=`pwd`/../prebuilts/ndk/r20 ./gradlew archiveZip # Without Tuning Fork
ANDROID_HOME=`pwd`/../prebuilts/sdk ANDROID_NDK=`pwd`/../prebuilts/ndk/r20 ./gradlew archiveTfZip # With Tuning Fork

Build with all prebuilt SDKs

Download the whole repository with all available prebuilt Android SDKs and NDKs (~23GB).

repo sync -c -j8

Build static and dynamic libraries for several SDK/NDK pairs.

cd gamesdk
ANDROID_HOME=`pwd`/../prebuilts/sdk ./gradlew gamesdkZip

Tests

./gradlew localUnitTests # Requires a connected ARM64 device to run
./gradlew localDeviceInfoUnitTests # No device required, tests are running on host

Samples

Samples are classic Android projects, using CMake to build the native code. They are also all triggering the build of the Game SDK.

Using Grade command line:

cd samples/bouncyball && ./gradlew assemble
cd samples/cube && ./gradlew assemble
cd samples/tuningfork/tftestapp && ./gradlew assemble

The Android SDK/NDK exposed using environment variables (ANDROID_HOME) will be used for building both the sample project and the Game SDK.

Using Android Studio

Open projects using Android Studio:

  • samples/bouncyball
  • samples/cube
  • samples/tuningfork/tftestapp

and run them directly (Shift + F10 on Linux, Control + R on macOS). The local Android SDK/NDK (configured in Android Studio) will be used for building both the sample project and the Game SDK.

Development and debugging

After opening a sample project using Android Studio, uncomment the line containing add_gamesdk_sources(). This will add the Swappy/Tuning Fork sources as part of the project. You can then inspect the source code (with working auto completions) and run the app in debug mode (with working breakpoints and inspectors).