3.8 KiB
3.8 KiB
name, description
| name | description |
|---|---|
| android-build-install | Build and install the GameTime Android phone and watch APKs from validated local code. Use when Codex needs to rebuild release APKs, free space in /tmp if needed, route Gradle/Kotlin/Flutter caches to writable directories, and install with adb on connected devices, uninstalling the previous app only if install -r fails. |
Android Build Install
Build the phone and watch release APKs from the current validated codebase, using writable cache locations and a compatible JDK.
Workflow
- Check free space on
/tmpand listgametime-*temporary folders. - If
/tmpis too full for a build copy, delete only stalegametime-*temporary folders created by prior build/archive attempts. Never mass-delete unrelated/tmpcontent. - Detect the current git state and decide the build source.
- If the current worktree already contains the validated fixes to package, use it directly when possible.
- If integration must combine validated changes from multiple branches that are not merged yet, create a temporary build workspace under
/tmp/gametime-build-<timestamp>from the chosen base branch or archive, then overlay the validated files or patch set needed for the target build. - Copy Android signing files required by the repo into the build workspace when the build runs outside the project root.
- Force writable tool state before building:
HOME=/home/anthony/Documents/Projects/GameTime/.build-homePUB_CACHE=/home/anthony/Documents/Projects/GameTime/.build-home/.pub-cacheXDG_CONFIG_HOME=/home/anthony/Documents/Projects/GameTime/.build-home/.configXDG_CACHE_HOME=/home/anthony/Documents/Projects/GameTime/.build-home/.cacheXDG_DATA_HOME=/home/anthony/Documents/Projects/GameTime/.build-home/.local/shareANDROID_USER_HOME=/home/anthony/Documents/Projects/GameTime/.build-home/.androidGRADLE_USER_HOMEto a phone- or watch-specific directory under.build-homeJAVA_HOME=/usr/lib/jvm/java-21-openjdk- prepend
$JAVA_HOME/bintoPATH _JAVA_OPTIONS=-Duser.home=/home/anthony/Documents/Projects/GameTime/.build-home -Djava.io.tmpdir=/home/anthony/Documents/Projects/GameTime/.build-home/.tmp -Dkotlin.daemon.enabled=false -Dkotlin.compiler.execution.strategy=in-processGRADLE_OPTS=-Dorg.gradle.jvmargs=-Xmx4g -Dkotlin.daemon.enabled=false -Dkotlin.compiler.execution.strategy=in-process -Duser.home=/home/anthony/Documents/Projects/GameTime/.build-home -Djava.io.tmpdir=/home/anthony/Documents/Projects/GameTime/.build-home/.tmpFLUTTER_SUPPRESS_ANALYTICS=true
- Build the phone APK with
flutter build apk --releasefrom the app root. - Build the watch APK with
flutter build apk --releasefromwatch_app/. - Record the final APK paths.
Installation
- Run
adb devices -l. - Identify the phone and watch endpoints explicitly before installing.
- Install the phone APK with
adb -s <serial> install -r <apk>. - Install the watch APK with
adb -s <serial> install -r <apk>. - Only if
install -rfails for a package upgrade reason, uninstallcom.gametime.appon that device and retry a plainadb install <apk>. - Report success or the exact adb error per device.
Guardrails
- Never delete arbitrary
/tmpcontent; only remove targetedgametime-*temporary folders that were created for build/archive work. - Prefer release APKs unless the user explicitly asks for debug builds.
- Keep phone and watch builds on the same validated code snapshot.
- If
adbshows duplicate watch endpoints, probe them and choose one working endpoint before install. - If git writes are blocked, avoid forcing repository state changes; use a temporary integrated build workspace instead.
- Report the exact APK output paths after a successful build.
- If build or install fails, report the real failing command and error instead of paraphrasing.