Fix local reference handling when exception has been thrown

Test: build and run on API 16 device
Bug: 157227070
Change-Id: I896e595d91dfaa7d3db3b5925dfbc30e90110db7
1 file changed
tree: b854b792c4284d851da48d9ff5d0fe6a821ae5ae
  1. .gitignore
  2. LICENSE
  3. OWNERS
  4. PREUPLOAD.cfg
  5. README.md
  6. RELEASE_NOTES
  7. THIRD_PARTY_NOTICES
  8. ab_info.py
  9. bender/
  10. build.bat
  11. build.gradle
  12. build.sh
  13. cert/
  14. download.sh
  15. gradle.properties
  16. gradle/
  17. gradlew
  18. gradlew.bat
  19. hooks/
  20. include/
  21. samples/
  22. settings.gradle
  23. src/
  24. test/
  25. third_party/
README.md

Android Game SDK

Integrating the Game SDK in your game

Unless you need to compile the Game SDK from sources, it's recommended that you use the package with the pre-compiled library. You can download it on https://developer.android.com/games/sdk.

Build the Game SDK

In order to build the Game SDK, this project must be initialized using the repo tool. On Windows, we recommend running all commands involving repo with Git Bash, to avoid issues with symlinks.

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 external/modp_b64 external/googletest external/nanopb-c external/protobuf
repo sync -c -j8 prebuilts/cmake/linux-x86 prebuilts/cmake/windows-x86 prebuilts/cmake/darwin-x86

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 external/modp_b64 external/googletest external/nanopb-c external/protobuf
repo sync -c -j8 prebuilts/cmake/linux-x86 prebuilts/cmake/windows-x86 prebuilts/cmake/mac-x86

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/scaledballs && ./gradlew assemble
cd samples/tuningfork/expertballs && ./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/scaledballs
  • samples/tuningfork/expertballs

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).