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-activity 1.0.0 - - -
games-controller 1.0.0 - - -
games-frame-pacing 1.9.0 - - -
games-text-input 1.0.0 - - -
games-performance-tuner 1.4.3 - - -
This library was last updated on: August 4, 2021

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:

Groovy

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.9.0"

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

    // To use the Games Activity library
    implementation "androidx.games:games-activity:1.0.0"

    // To use the Games Controller Library
    implementation "androidx.games:games-controller:1.0.0"

    // To use the Games Text Input Library
    implementation "androidx.games:games-text-input:1.0.0"
}

Kotlin

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

    // To use the Android Performance Tuner
    implementation("androidx.games:games-performance-tuner:1.4.3")

    // To use the Games Activity library
    implementation("androidx.games:games-activity:1.0.0")

    // To use the Games Controller Library
    implementation("androidx.games:games-controller:1.0.0")

    // To use the Games Text Input Library
    implementation("androidx.games:games-text-input:1.0.0")
}
}

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-Activity Version 1.0.0

Version 1.0.0

August 4, 2021

androidx.games:games-activity:1.0.0, androidx.games:games-controller:1.0.0, and androidx.games:games-text-input:1.0.0 are released. Version 1.0.0 contains these commits.

Major features of 1.0.0

This is the initial release to stable of Games-Activity, Games-Controller and Games-Text-Input. See the AGDK Home Page for more information.

Version 1.0.0-rc01

July 12, 2021

androidx.games:games-activity:1.0.0-rc01 is released. Version 1.0.0-rc01 contains these commits.

Bug Fixes

  • Fix return type of GameActivityCallbacks::onSaveInstanceState

Version 1.0.0-beta01

June 30, 2021

androidx.games:games-activity:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

API Changes

  • Rename GameActivityInputInfo to GameActivityPointerAxes.
  • onNativeWindowResized callback now gives width and height of window.
  • onContentRectChanged callback has been removed.
  • onLowMemory was renamed to onTrimMemory.
  • GameActivity_setWindowFormat removed.
  • Improved ownership model for GameActivityMotionEvents and GameActivityMotionEvent pointers.
  • Improved ownership model of user state in onSaveInstanceState callback.

Version 1.0.0-alpha01

June 16, 2021

androidx.games:games-activity:1.0.0-alpha01 is released.

New Features

  • Games-Activity is a new library that replaces NativeActivity as the recommended way to integrate a C/C++ game with Android.

Games-Controller Version 1.0.0

Version 1.0.0

August 4, 2021

androidx.games:games-activity:1.0.0, androidx.games:games-controller:1.0.0, and androidx.games:games-text-input:1.0.0 are released. Version 1.0.0 contains these commits.

Major features of 1.0.0

This is the initial release to stable of Games-Activity, Games-Controller and Games-Text-Input. See the AGDK Home Page for more information.

Version 1.0.0-rc02

July 21, 2021

androidx.games:games-controller:1.0.0-rc02 is released. Version 1.0.0-rc02 contains these commits.

Bug Fixes

  • Fixed packaging error that caused Prefab import to fail on empty, unused architecture/version permutations.

Version 1.0.0-rc01

July 12, 2021

androidx.games:games-controller:1.0.0-rc01 is released. Version 1.0.0-rc01 contains these commits.

Bug Fixes

  • Fixed an incompatibility issue with the latest GameActivity

Version 1.0.0-beta01

June 30, 2021

androidx.games:games-controller:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

API Changes

  • Functions which returned a boolean for success or failure now return a Paddleboat_Error_Code enum.
  • Paddleboat_onPause renamed to Paddleboat_onStop
  • Paddleboat_onResume renamed to Paddleboat_onStart
  • Paddleboat_processGameActivityEvent split into two functions: Paddleboat_processGameActivityKeyInputEvent and Paddleboat_processGameActivityMotionInputEvent
  • Removed extended controller features that required building against a preview Android S SDK
  • Added Paddleboat_getBackButtonConsumed function
  • Controller and mouse status callbacks now have an optional parameter of a pointer to user defined data
  • Moved controller name string out of device info structure, now accessed via Paddleboat_getControllerName function

Bug Fixes

  • Fixed an issue where a controller that doesn’t initially report itself as a controller, but later on does via an onInputDeviceChanged message, wasn’t being properly detected as a controller connection.

Version 1.0.0-alpha01

June 16, 2021

androidx.games:games-controller:1.0.0-alpha01 is released.

New Features

  • Games-Controller is a new library that provides a C API for detecting, reading input from, and interacting with game controller devices.

Games-Text-Input Version 1.0.0

Version 1.0.0

August 4, 2021

androidx.games:games-activity:1.0.0, androidx.games:games-controller:1.0.0, and androidx.games:games-text-input:1.0.0 are released. Version 1.0.0 contains these commits.

Major features of 1.0.0

This is the initial release to stable of Games-Activity, Games-Controller and Games-Text-Input. See the AGDK Home Page for more information.

Version 1.0.0-rc01

July 12, 2021

androidx.games:games-text-input:1.0.0-rc01 is released with no changes. Version 1.0.0-rc01 contains these commits.

Version 1.0.0-beta01

June 30, 2021

androidx.games:games-text-input:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

API Changes

  • Improved ownership model of GameTextInputState objects.
  • Tidying of types to be consistent with NDK.

Version 1.0.0-alpha01

June 16, 2021

androidx.games:games-text-input:1.0.0-alpha01 is released.

New Features

  • Games-Text-Input is a new library to help game developers use Android soft keyboard input from C/C++.

Games Frame Pacing 1.9.0

Version 1.9.0

July 12, 2021

androidx.games:games-frame-pacing:1.9.0 is released. Version 1.9.0 contains these commits.

Important changes since 1.7.0

  • Updated to match internal versioning scheme.

Games Frame Pacing 1.7.0

Version 1.7.0

June 30, 2021

androidx.games:games-frame-pacing:1.7.0 is released. Version 1.7.0 contains these commits.

Version 1.7.0-rc01

June 2, 2021

androidx.games:games-frame-pacing:1.7.0-rc01 is released. Version 1.7.0-rc01 contains these commits.

Version 1.7.0-beta02

February 24, 2021

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

Version 1.7.0-beta01

December 16, 2020

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

Games Performance Tuner 1.4.3

Version 1.4.3

July 12, 2021

androidx.games:games-performance-tuner:1.4.3 is released. Version 1.4.3 contains these commits.

Important changes since 1.1.0

  • Updated to match internal versioning scheme.

Games Performance Tuner 1.1.0

Version 1.1.0

June 30, 2021

androidx.games:games-performance-tuner:1.1.0 is released. Version 1.1.0 contains these commits.

Version 1.1.0-rc01

June 2, 2021

androidx.games:games-performance-tuner:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.

Version 1.1.0-beta03

April 21, 2021

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

Version 1.1.0-beta02

February 24, 2021

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

Version 1.1.0-beta01

December 16, 2020

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

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.