Android Debugging
Engine-owned documentation. Paths under
../are relative to the FOnline engine root. Paths under../../point to an embedding game project such as Last Frontier when this engine is used as a submodule.
Practical reference for building, packaging, installing, and remote-scene debugging the Android client.
Workflow Overview
Android debug work is split into four layers:
- prepare the Android SDK/NDK workspace parts;
- build the Android client native library;
- package a Gradle project with baked resources;
- build/install/launch the APK on a Wi-Fi ADB device.
The current supported platform identifiers are android-arm32, android-arm64, and android-x86. Most local tasks use android-arm64. Official package targets currently emit Android APKs only for the production-like Daily, Staging, and Prod packages; AndroidTest remains a raw LocalTest client package.
The high-level command flow from the repo root is:
bash ../BuildTools/prepare-workspace.sh android-arm64
python3 ../BuildTools/buildtools.py build android-arm64 client RelWithDebInfo
python3 ../BuildTools/buildtools.py package-android-debug LF android-arm64 LocalTest
python3 ../BuildTools/android_device.py --workspace-root Workspace connect
cd Workspace/android-debug/LF-Client-LocalTest-Android
./gradlew assembleDebug
python3 ../BuildTools/android_device.py --workspace-root Workspace install --apk Workspace/android-debug/LF-Client-LocalTest-Android/app/build/outputs/apk/debug/app-debug.apk
python3 ../BuildTools/android_device.py --workspace-root Workspace launch --activity com.lastfrontier.app/.FOnlineActivity
python3 ../BuildTools/android_device.py --workspace-root Workspace logcat
VS Code Task Flow
The active Linux VS Code Android launch tasks are thin wrappers around the same BuildTools entry points:
Android :: Prepare WorkspaceAndroid :: Build ClientAndroid :: Build Debug PackageAndroid :: Build APKAndroid :: Connect DeviceAndroid :: Install APKAndroid :: Launch AppAndroid :: Logs App
Android :: Prepare Launch [linux] runs the standard sequence for a LocalTest APK.
Android :: Launch Remote Scene [linux] runs the remote-scene sequence: select scene, prepare workspace, bake resources, build LF_ServerHeadless, build/package/install RemoteSceneLaunch, stop older scene servers on the gameplay ports, start a fresh headless scene server, stop the app, and launch it with a server-host override.
Remote Scene Launch
Android scene debugging uses the RemoteSceneLaunch subconfig rather than the embedded-client SceneLaunch path.
Important differences:
- the server is
LF_ServerHeadlesson the host; - the Android client is a separate device process;
Server.AutoStartClientOnServerstays disabled;android_device.py launch-gamepassesClientNetwork.ServerHostas an Android activity extra;- if
--server-hostis omitted,android_device.pyauto-detects the host LAN IP by checking the route to the selected Wi-Fi device.
Use Android :: Launch Remote Scene [linux] after compatibility-affecting changes. Launching only the already installed APK can leave an older client talking to a newer scene server and produce Client outdated style failures.
Official Package Targets
The local debug flow above uses package-android-debug and then Gradle assembleDebug from Workspace/android-debug/.... The CI/release package flow is different: MakePackage-Daily, MakePackage-Staging, and MakePackage-Prod are generated from ../../CMakeLists.txt DefinePackage(...) entries and include BINARY Client Android arm64 Apk alongside the Windows, Web, and Linux server artifacts.
CI prepares Android prerequisites only for those three package types before running the matching ../BuildTools/toolset.sh MakePackage-<type> target. The generated package lands under Workspace/output/LF-<type> and includes the installable Android arm64 APK produced through the shared ../BuildTools/package.py Android packager. The official packager invokes Gradle with --no-daemon so concurrent package jobs on the same self-hosted runner do not reuse or kill each other’s Gradle daemon.
Use this split when debugging Android output:
- LocalTest/RemoteSceneLaunch device debugging -> inspect
package-android-debug,Workspace/android-debug/LF-Client-*-Android, Wi-Fi ADB, and the VS Code Android tasks. - Daily/Staging/Prod APK artifact issue -> inspect
../../CMakeLists.txtpackage definitions,.github/workflows/ci.ymlpackage matrix,MakePackage-<type>, andWorkspace/output/LF-<type>rather than the local debug Gradle directory first. - AndroidTest package issue -> remember it is defined as
BINARY Client Android arm64 Raw, not an APK-producing package target.
Runtime Resource Copy
Android packaging moves baked client resources into the Gradle project under app/src/main/assets/Resources.
On first launch after install/update, FOnlineActivity copies those assets into the app files directory and starts the engine with absolute overrides for:
Baking.ClientResourcesBaking.CacheResources
The activity tracks an .asset_revision based on Android package metadata and recopies resources when the installed package changes.
Practical Debugging Notes
When Android launch behavior fails, isolate the failing layer before rebuilding the whole stack:
- workspace prepare fails before build -> check
../ThirdParty/android-sdk,../ThirdParty/android-ndk, and whetherWorkspace/android-sdk/Workspace/android-ndkwere prepared byprepare-workspace.sh. - Gradle project exists but APK build fails -> inspect
Workspace/android-debug/LF-Client-*-Android/local.properties; the VS Code tasks fall back toWorkspace/android-sdkand then/usr/lib/android-sdkif needed. - APK install is canceled on device -> rerun
android_device.py installafter approving Android wireless debugging or unknown-app-install prompts on the device. - device is not found -> run
android_device.py discover/connect; the helper usesadb mdns services, cachesWorkspace/android-debug/device-endpoint.txt, and falls back to manualIP[:port]input. - RemoteSceneLaunch app cannot connect back to host -> check the
launch-gameClientNetwork.ServerHostoverride, the selected Wi-Fi route, and whether host ports4025/4026are already occupied by a stale server. - scene launch opens the wrong scene -> inspect the selected
startupSceneName,LF_ServerHeadless --ApplySubConfig RemoteSceneLaunch --Scene.Startup <SceneId>, and the installed package path. - resources are stale after reinstall -> verify the APK was rebuilt from the expected
Workspace/android-debug/LF-Client-*-Androiddirectory and thatFOnlineActivityrecopied assets by checking app logs for resource-copy failures. - packaging fails on icon or signing -> inspect
Android.Icon,Android.Keystore,Android.KeystorePassword,Android.KeyAlias, andAndroid.KeyPasswordin../../LastFrontier.fomain; icon input must be a PNG, and partial signing config is invalid. - CI package contains Windows/Web/Linux artifacts but no Android APK -> check whether the package is
Daily,Staging, orProd; CI preparesandroid-arm64only for those matrix types, and only package definitions withBINARY Client Android arm64 Apkemit APKs.
Key Files and Integration Points
If you need to trace the Android debug flow through the live repository, start with these files:
README.md- concise repo-front-door Android command flow that this detailed device/debug guide expands../../CMakeLists.txt-AndroidTest,Daily,Staging, andProdpackage definitions, including which package targets emitAndroid arm64 Apkartifacts.github/workflows/ci.yml- package matrix and Android workspace preparation gate forProd,Staging, andDaily../../.vscode/tasks.json- live Android task graph for workspace prep, package build, install, remote-scene server startup, and app launch../BuildTools/buildtools.py- Android platform identifiers, workspace feature mapping, andpackage-android-debugentry point../BuildTools/android_device.py- Wi-Fi ADB discovery, connection caching, install, launch,launch-game, stop, and logcat helper../BuildTools/package.py- Android Gradle project generation, resource movement, icon/signing config, and APK build integration used by both debug and package targets../BuildTools/android-project/- Gradle and activity template patched by the packager../BuildTools/android-project/app/src/main/java-template/FOnlineActivity.java- runtime resource copy andClientNetwork.ServerHostargument forwarding../../LastFrontier.fomain-Android.*,LocalTest, andRemoteSceneLaunchconfig values used by packaging and launchBuildAndLaunch.mdandDocs/Scenes.md- companion references for general launch selection and scene-debug behavior
Validation and Tests
Current checks worth running when Android build, packaging, or launch docs change:
../../.vscode/tasks.jsonconfirms the current task names, package paths, APK paths, and remote-scene sequence.README.mdremains the front-door summary for the concise Android command flow; this guide owns detailed Wi-Fi ADB, Gradle project, package-output, and remote-scene troubleshooting behavior.../../CMakeLists.txtconfirms which official package targets emit Android APKs, especiallyDaily,Staging, andProdwithBINARY Client Android arm64 Apk..github/workflows/ci.ymlconfirms CI preparesandroid-arm64only for the APK-producing package matrix types.../BuildTools/android_device.pyconfirms the current helper commands and failure messages around Wi-Fi ADB discovery/installation.../BuildTools/package.pyconfirms Android config keys, icon requirements, signing behavior, and resource movement into APK assets.FOnlineActivity.javaconfirms runtime resource copy andClientNetwork.ServerHostoverride handling.
See Also
- BuildAndLaunch.md — general build and launch entry points
- Scenes.md —
SceneLaunchvsRemoteSceneLaunchbehavior - WebDebugging.md — sibling remote-scene workflow for browser clients
- GuiSystem.md and Localization.md — generated-screen and text-presentation references when APK/device startup is healthy but UI output is wrong