Skip to content

Android Development Guide

Peter Robinson edited this page Jun 27, 2026 · 3 revisions

The build instructions have moved. Torque2D now uses a single CMake-based build for every platform.

See Building from Source for the current Android build — the engine is compiled as libtorque2d.so through Gradle → CMake (NDK), targeting arm64-v8a, from engine/compilers/android-studio (./gradlew assembleDebug). The previous Eclipse / ndk-build / Android.mk workflow is obsolete and has been removed.


Is Android working yet?

Yes! As of the 4.0 CMake migration, the engine builds, boots, and runs on a real Android device (verified on a Pixel 7 Pro, Android 13, via Firebase Test Lab). The editor starts up, OpenGL ES comes alive, all the editor modules load, and the Project Manager renders with real text — no crashes. A few stylized heading fonts are still blank (see the Fonts note below), but the engine itself is up and running.

If you hit a crash on your own device, grab a logcat and filter on the tag Torque2D — that's where the engine prints its own startup messages, which makes it much easier to see how far boot got.

Android runtime & scripting notes

These are platform-specific behaviors to keep in mind when building a game for Android (they are about running on Android, not about compiling the engine):

  • Back button: main.cs defines an androidBackButton callback (one parameter: true/false for button down/up). By default it quits Torque when pressed; override it to suit your game.
  • Splash screen: the splash is a Java dialog that must be dismissed from script. Call hideSplashScreen() when your game has finished loading.
  • Fonts: Android can get glyphs three ways — from a desktop-generated .uft cache that ships with your game, from the device's own system fonts (these vary by device and Android version), and from your own TrueType (.ttf) files dropped into assets/fonts. On-device lookup is by partial name: asking for "Roboto" matches the first device (or bundled) font whose embedded name contains "Roboto". Roboto is the modern Android system font (the old "Droid" family is long gone — if you have an old guide or profile asking for "Droid", change it to "Roboto"), and Torque2D also bundles Roboto-Regular.ttf in assets/fonts so it's always there even on a stripped-down device. Call dumpFontList() to print every font the engine found to logcat — handy if a face isn't showing up.
    • Heads-up — a font's name has to be readable. Torque reads the font's name out of the .ttf to match it. Modern fonts (including Roboto) store that name in the Windows record format; the engine was recently fixed to read it (it used to only read the old Macintosh format, which left the font list empty and crashed the editor on Android). If you're on an older build and text won't load, that's why — update the engine.
    • A few decorative heading fonts may render blank. If a font has no baked .uft cache and isn't a real installed/bundled .ttf (the editor's stylized "black ops one" titles are the usual culprit), Android currently can't synthesize it and that text just won't appear. Your normal UI text (Roboto) is unaffected. Bundling the matching .ttf in assets/fonts, or pre-baking a .uft, makes it render.
  • Lifecycle callbacks: Android delivers three platform callbacks in addition to androidBackButtononAndroidResignActive (app sent to background), onAndroidBecomeActive (app regains focus), and onAndroidWillTerminate (fired before the general onExit, before shutdown). The engine does not auto-pause audio when backgrounded; script that yourself.

Clone this wiki locally