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.
73 lines
2.2 KiB
Bash
Executable File
73 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Deploy APK to connected Android device
|
|
|
|
set -e
|
|
|
|
echo "📱 Deploying to Android device..."
|
|
echo ""
|
|
|
|
# Check if device is connected
|
|
if ! adb devices | grep -q "device$"; then
|
|
echo "❌ No Android device connected!"
|
|
echo "Please connect a device or start an emulator."
|
|
exit 1
|
|
fi
|
|
|
|
# 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 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"
|
|
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"
|
|
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
|
|
|
|
echo "📦 Installing APK: $APK_PATH"
|
|
echo "📛 Package: $APP_PACKAGE"
|
|
|
|
if ! adb install -r "$APK_PATH"; then
|
|
echo ""
|
|
echo "❌ Install failed."
|
|
echo " If it says INSTALL_FAILED_UPDATE_INCOMPATIBLE, an older build of"
|
|
echo " '$APP_PACKAGE' signed with a different key is still installed."
|
|
echo " Uninstall just that one and retry:"
|
|
echo " adb uninstall $APP_PACKAGE"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "✅ Deployment complete!"
|
|
echo "🚀 Launching..."
|
|
adb shell monkey -p "$APP_PACKAGE" -c android.intent.category.LAUNCHER 1 > /dev/null 2>&1 \
|
|
|| echo " (auto-launch failed — start it from the launcher)"
|