Android Games

The android games library mirrors the Android Game SDK which is available as a binary download. You can use the androidx library instead of manually downloading and integrating the Android Game SDK into your build.

For more information about the Android Game SDK, see the SDK documentation and the SDK release notes.

This table lists all the artifacts in the androidx.games group.

Artifact Current Stable Release Next Release Candidate Beta Release Alpha Release
games-frame-pacing - - - 1.7.0-alpha01
games-performance-tuner - - - 1.1.0-alpha01
This library was last updated on: October 28, 2020

Declaring dependencies

To add a dependency on game, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

android {
    ...
    // To use the Android Frame Pacing or Android Performance Tuner libraries, enable
    // native dependencies to be imported. Libraries will be made available to your CMake build
    // as packages named "games-frame-pacing" and "games-performance-tuner".
    buildFeatures {
        prefab true
    }
}

dependencies {
    // To use the Android Frame Pacing library
    implementation "androidx.games:games-frame-pacing:1.7.0-alpha01"

    // To use the Android Performance Tuner
    implementation "androidx.games:games-performance-tuner:1.1.0-alpha01"
}

For more information about dependencies, see Add build dependencies.

Add Gradle properties

You may need to add properties to the gradle.properties file located in the same directory as your app's (or module's) build.gradle file. If the gradle.properties file does not exist, then create this file.

If you are using Android Studio 4.0, make sure gradle.properties contains the following lines:

# Enables experimental Prefab
android.enablePrefab=true
# Tell Android Studio we are using AndroidX
android.useAndroidX=true

If you are using Android Studio 4.1 or later, make sure gradle.properties contains the following lines:

# Tell Android Studio we are using AndroidX
android.useAndroidX=true

Add packages with CMake

To make the imported Game SDK packages available, add the following to your main app's CMakeLists.txt file:

# Add the packages from the Android Game SDK
find_package(games-frame-pacing REQUIRED CONFIG)
find_package(games-performance-tuner REQUIRED CONFIG)

This will allow you to include header files from the Android Game SDK in your game code:

#include "swappy/swappyGL.h"
#include "tuningfork/tuningfork.h"

In your main app's CMakeLists.txt file, find target_link_libraries for the main shared library. Add the references to the Android Game SDK static libraries to include them in your shared library:

target_link_libraries(...
  games-frame-pacing::swappy_static
  games-performance-tuner::tuningfork_static
  ...)

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Games Frame Pacing 1.7.0

Version 1.7.0-alpha01

androidx.games:games-frame-pacing:1.7.0-alpha01 is released.

Games Performance Tuner 1.1.0

Version 1.1.0-alpha01

androidx.games:games-performance-tuner:1.1.0-alpha01 is released.

Version 1.0.0

Version 1.0.0-alpha02

August 12, 2020

The Android Gaming library was renamed to the Android Games library.

androidx.gaming -> androidx.games

Version 1.0.0-alpha01

June 10, 2020

androidx.games:1.0.0-alpha01 is released.