Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Android release: 240 px built in, the sharper animations as Play asset packs

Duarte Santos2c5b05ac4ad7
diff --git a/docs/APP_STORES.md b/docs/APP_STORES.md
index 57b690536..61ddb6235 100644
--- a/docs/APP_STORES.md
+++ b/docs/APP_STORES.md
@@ -22,9 +22,12 @@ ever sees the repo's 180 px media.
## Requirements the builds meet
- **Google Play:** targets Android 16 (API 36), required for new apps and updates since
- 31 August 2026 (Capacitor 8). Native libraries are 16 KB page aligned. The bundle is about
- 290 MB, under Play's 500 MB limit for the base module, so the animations stay in the base
- module and no asset packs are needed.
+ 31 August 2026 (Capacitor 8). Native libraries are 16 KB page aligned. The base module carries
+ the 240 px animations (about 400 MB, under Play's 500 MB; build-release.sh checks it). The
+ sharper qualities are on-demand **Play asset packs** (Play Asset Delivery), one per quality and
+ figure like the iPhone's, each under Play's 1.5 GB per pack (a bigger one is split into parts),
+ far under the 30 GB for all on-demand packs together. Google Play delivers them; the sideloaded
+ APK has none and keeps its 240 px.
- **App Store:** built with Xcode 26 (the `macos-26` runner). Privacy manifest
(`ios/App/App/PrivacyInfo.xcprivacy`): no tracking, no data collected. No non-exempt
encryption (`ITSAppUsesNonExemptEncryption = NO`, HTTPS only). The Coach asks before anything
@@ -48,6 +51,13 @@ scripts/android/build-release.sh $K/opengym-release.keystore $K/keystore.pass $K
# → openGym-X.Y.Z.apk (+ .sha256) for the GitHub release, openGym-X.Y.Z.aab for Google Play
```
+Both have the box-free 240 px animations built in (`quality/240`). The bundle also gets an asset
+pack for every quality above 240 that has a folder in `/mnt/backup-hdd/opengym-media/quality/`
+(`scripts/android/make-asset-packs.mjs`, the same drawings per pack as the iPhone's); the pack
+modules are generated into `frontend/android/` for the build and removed after, never committed.
+To try packs on an emulator: `make-asset-packs.mjs --px 240 --builtin 180 --limit 30`, then
+`./gradlew bundlePlayDebug` and `bundletool build-apks --local-testing` + `install-apks`.
+
Upload the `.aab` in Play Console → Test and release → Production (or a testing track first),
with the release notes from the changelog.
diff --git a/scripts/android/build-release.sh b/scripts/android/build-release.sh
index a54350425..3fdc9f4ee 100755
--- a/scripts/android/build-release.sh
+++ b/scripts/android/build-release.sh
@@ -2,20 +2,28 @@
# Builds and signs both Android releases on the release machine, from one phone build:
# openGym-<version>.apk the sideloaded APK (GitHub, opengym.ch): updates itself
# openGym-<version>.aab the Google Play bundle: Play updates it
-# The full-quality animations go into both packages and nowhere else (Gym visual licence,
-# Part B), which is why this runs here and not in CI. Same key for both: a phone can move from
-# the APK to Google Play and keep its data, as long as Play App Signing uses this key too
-# (docs/APP_STORES.md).
+# Both carry the 240 px animations built in (the box-free set, quality/240); the Play bundle also
+# carries the sharper ones as on-demand Play asset packs (scripts/android/make-asset-packs.mjs:
+# every quality above 240 whose folder exists), which Google Play delivers when someone picks
+# them. These animations go into the packages and nowhere else (Gym visual licence, Part B), which
+# is why this runs here and not in CI; the pack modules are taken out of the project again at the
+# end. Same key for both: a phone can move from the APK to Google Play and keep its data, as long
+# as Play App Signing uses this key too (docs/APP_STORES.md).
#
# Usage: scripts/android/build-release.sh <keystore> <password-file> <alias-file> [out-dir]
-# APP_MEDIA_DIR defaults to /mnt/backup-hdd/opengym-media/build-appwebp.
+# APP_MEDIA_DIR the built-in animations, default /mnt/backup-hdd/opengym-media/quality/240
+# VITE_BUILTIN_CLIP_PX their size, default 240
+# PACK_SRC_ROOT the quality folders the packs come from, default .../opengym-media/quality
+# NO_PACKS=1 a Play bundle without asset packs
set -euo pipefail
KS=${1:?keystore}; PASS=${2:?file with the keystore password}; ALIAS=$(cat "${3:?file with the key alias}")
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
OUT=${4:-$PWD}
-export APP_MEDIA_DIR=${APP_MEDIA_DIR:-/mnt/backup-hdd/opengym-media/build-appwebp}
+export APP_MEDIA_DIR=${APP_MEDIA_DIR:-/mnt/backup-hdd/opengym-media/quality/240}
+export VITE_BUILTIN_CLIP_PX=${VITE_BUILTIN_CLIP_PX:-240}
export VITE_CLIP_EXT=webp
+PACK_SRC_ROOT=${PACK_SRC_ROOT:-/mnt/backup-hdd/opengym-media/quality}
: "${ANDROID_HOME:?set ANDROID_HOME}"
BT=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)
@@ -25,6 +33,10 @@ GRADLE_VER=$(sed -n 's/.*versionName "\(.*\)"/\1/p' android/app/build.gradle)
[ "$VER" = "$GRADLE_VER" ] || { echo "package.json says $VER, build.gradle says $GRADLE_VER" >&2; exit 1; }
npm run build:mobile
+if [ -z "${NO_PACKS:-}" ]; then
+ trap 'node "$ROOT/scripts/android/make-asset-packs.mjs" --clean' EXIT
+ node "$ROOT/scripts/android/make-asset-packs.mjs" --builtin "$VITE_BUILTIN_CLIP_PX" --src-root "$PACK_SRC_ROOT"
+fi
(cd android && ./gradlew --no-daemon clean assembleSideloadRelease bundlePlayRelease)
APK_IN=android/app/build/outputs/apk/sideload/release/app-sideload-release-unsigned.apk
@@ -45,3 +57,8 @@ jarsigner -keystore "$KS" -storepass:file "$PASS" -keypass:file "$PASS" \
jarsigner -verify "$OUT/openGym-$VER.aab" | grep -q "jar verified" || { echo "the bundle did not verify" >&2; exit 1; }
ls -la "$OUT/openGym-$VER.apk" "$OUT/openGym-$VER.aab"
+# Google Play's limits: 500 MB for the base module, 1.5 GB per asset pack (the packs are split
+# below that by make-asset-packs.mjs). The base is what the bundle holds outside the packs.
+BASE=$(unzip -l "$OUT/openGym-$VER.aab" | awk '$4 != "" && $4 !~ /^anim_/ {s+=$1} END {print s}')
+echo "base module: $((BASE / 1024 / 1024)) MB (Play allows 500 MB)"
+[ "$BASE" -lt $((500 * 1024 * 1024)) ] || { echo "the base module is over Play's 500 MB" >&2; exit 1; }