Android
Android export is provided by the org.mass4.turian.android brick and is still in development. The brick adds an android platform to the project's build profiles. It exports client builds only, as CoreCLR applications, and does not support NativeAOT. Read the verification section before you rely on it for a release.
Install the brick
Add the brick to the project's Bricks/manifest.json as a dependency, from the brick registry or from a local checkout:
{
"dependencies": {
"org.mass4.turian.android": "file:<path to org.mass4.turian.android>"
}
}
Then restore the project's bricks and add a build profile for the platform:
turian-cli brick restore --project MyGame
In Project → Build Profiles…, choose Add Build Profile and pick Android Client. Profiles are described in Build Profiles.
Requirements
- Android 13 (API 33) or newer on the device. Below that the game does not install.
- A device with Vulkan 1.3 that supports synchronization 2, dynamic rendering and anisotropic filtering. Turian checks these before it creates the renderer and reports the missing feature if one is absent.
- The .NET SDK with its Android workload:
dotnet workload install android. - The Android SDK and a JDK 17 or newer. Turian finds them through
ANDROID_HOMEorANDROID_SDK_ROOT,JAVA_HOME, the folders Android Studio uses, and installed JDKs. To point at other folders, set them in Studio under Settings → Build → Android. The CLI reads the same per-user file.
Check the toolchain
doctor reports whether each platform can export, without exporting anything:
turian-cli doctor android --project MyGame
turian-cli doctor --project MyGame
Each platform prints one line, READY or MISSING, followed by what is wrong:
android: MISSING - The Android SDK was not found: install it with Android Studio or the command-line tools, or set its folder in Settings, Build, Android.
The command exits with 1 when any checked platform is not ready, so it can gate a CI job. Omit the platform name to check every installed platform. If the platform is not installed, doctor says so and suggests running brick restore.
Application identifier and version code
The export reads two settings. Set both before you export:
- Player Settings → Application Identifier is the package name the device uses to identify the game. It needs at least two dot-separated segments, such as
org.example.game. Each segment starts with an ASCII letter and holds only ASCII letters, digits and underscores. An empty identifier is invalid. - Android Player Settings → Version Code is the positive integer Android uses to order updates. It defaults to
1, and each release you upload needs a higher one.
An invalid value stops the export before compilation, with a message that names the setting. A new project starts with an identifier made from its name under com.turian, so change it before you publish.
AndroidPlayerSettings also holds the options below:
| Field | Meaning |
|---|---|
| Back Button Quits | Off by default. The system Back button sends Escape to the game. On quits the game. |
| Package Format | Apk (the default) or Aab, an App Bundle for store upload that also contains an installable APK. |
| Keystore Path and Key Alias | Required for release builds. The keystore passwords come from the TURIAN_ANDROID_KEYSTORE_PASSWORD environment variable. |
Export and run
turian-cli export MyGame --profile Android
turian-cli export MyGame --profile Android --install --device <serial>
The APK is written to Output/Android/<game>/. The --install option installs it on a connected device and starts it. --device names the device, and turian-cli devices MyGame lists the devices that are ready to install on.
turian-cli deploy MyGame --profile Android --device <serial>
deploy builds a temporary development player, installs it, starts it and shows the game's log until it exits. Ctrl+C stops the game. The saved profile is unchanged. Add --release to deploy the profile as authored, with its release signing.
Development builds use a debug keystore that Turian manages, so they need no keystore settings. The Studio Build & Run command follows the same rule when an Android profile is active.
Lifecycle as implemented
The game runs on its own thread, and the Android activity hands it the window surface and input.
- Ticks and rendering wait until the activity is resumed and the surface has a size. When the app goes to the background, pending input is cleared and the game pauses. When it returns, the game resumes.
- Losing the surface, such as when the window is hidden, resized to nothing or destroyed, suspends the game. When the surface is destroyed, the game thread releases the native window, and the Android UI thread waits at most two seconds for that, so a slow game cannot freeze the system UI.
- Touch and the safe-area insets are forwarded to the game.
- The game's packaged content is stored uncompressed in the APK (
.oap,.jsonand.pngfiles) so the runtime reads it in place.
What is verified
- The lifecycle has been exercised on physical hardware in local runs: cold starts, background and foreground cycles, rotation, process death with a return to the task, and a sustained play session.
- Not yet verified: restoring saved state after process death, activity recreation, split-screen, picture-in-picture and foldable layouts, lock and unlock, Android versions and devices other than the ones tested, and release-signed App Bundles uploaded to a store.
- NativeAOT and the Vulkan validation layer are separate. The validation layer ships only in development builds, and only when the optional
org.mass4.turian.android.validationbrick for the exported architecture is installed.
Because the platform is still in development, check the lifecycle on the devices you ship to before you release.