build(android): add a side-by-side release build for validating R8

R8 has broken release APKs here before by stripping the JNI-loaded player
and security classes, and the only way to reproduce that was to build with
the real signing key and clobber the install you actually use.

`./scripts/build-and-deploy.sh release --device --debug` now builds a
fully minified release APK — exactly what ships — into the .debug
applicationId slot, signed with the local debug keystore:

  release            com.dtourolle.jellytau        0.5.5
  release --debug    com.dtourolle.jellytau.debug  0.5.5-debug-release
  debug              com.dtourolle.jellytau.debug  0.5.5-debug

It shares the applicationId *and* the signature with the plain debug
build, so the two replace each other cleanly rather than colliding, and
the versionName suffix says which is currently installed. No real key is
needed, so the side-by-side path deliberately skips
write-keystore-properties.sh.

The flag reaches Gradle as JT_SIDE_BY_SIDE=1. CI never sets it, and the
release manifest merges byte-identical without it — verified both ways
through processUniversalReleaseMainManifest.

deploy-android.sh and build-and-deploy.sh learned the flag too, since the
APK path is unchanged but the package to launch is not.
This commit is contained in:
2026-08-16 10:42:59 +02:00
parent 886cbcb29a
commit 521acc75fd
6 changed files with 106 additions and 21 deletions
+25 -7
View File
@@ -13,24 +13,42 @@ if ! adb devices | grep -q "device$"; then
exit 1
fi
# Build type: debug or release (default: debug)
BUILD_TYPE="${1:-debug}"
# Build type: debug or release (default: debug). `--debug` alongside `release`
# means the side-by-side release build — same APK path, but it was packaged
# under the .debug applicationId, so the package to launch differs.
BUILD_TYPE="debug"
SIDE_BY_SIDE=0
for arg in "$@"; do
case "$arg" in
--debug|--side-by-side) SIDE_BY_SIDE=1 ;;
debug|release) BUILD_TYPE="$arg" ;;
esac
done
[ "$BUILD_TYPE" = "debug" ] && SIDE_BY_SIDE=1
# The debug build carries applicationIdSuffix ".debug" (see
# src-tauri/android/app/build.gradle.kts), so it is a separate package and
# installs alongside a release build — no uninstall dance needed.
# The .debug applicationId (see src-tauri/android/app/build.gradle.kts) is a
# separate package, so it installs alongside a real release build — no
# uninstall dance needed.
if [ "$BUILD_TYPE" = "release" ]; then
APK_PATH="src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk"
APP_PACKAGE="com.dtourolle.jellytau"
else
APK_PATH="src-tauri/gen/android/app/build/outputs/apk/universal/debug/app-universal-debug.apk"
fi
if [ "$SIDE_BY_SIDE" = "1" ]; then
APP_PACKAGE="com.dtourolle.jellytau.debug"
else
APP_PACKAGE="com.dtourolle.jellytau"
fi
# Check if APK exists
if [ ! -f "$APK_PATH" ]; then
echo "❌ APK not found at: $APK_PATH"
echo "Run './scripts/build-android.sh $BUILD_TYPE' first"
if [ "$BUILD_TYPE" = "release" ] && [ "$SIDE_BY_SIDE" = "1" ]; then
echo "Run './scripts/build-android.sh release --debug' first"
else
echo "Run './scripts/build-android.sh $BUILD_TYPE' first"
fi
exit 1
fi