#!/usr/bin/env bash # The detour build (ANDROID.md): cargo → strip → copy → gradle. Run from anywhere. set -euo pipefail cd /f/Coding/SoulStream source src-tauri/android/env.sh echo "== cargo $(date +%T)" cargo build --lib -p app --target aarch64-linux-android --features tauri/custom-protocol 2>&1 | grep -v "^\s*Compiling\|^\s*Fresh" # the grep above hides cargo's exit code; a failed compile must not package # the previous library as if it were this one test "${PIPESTATUS[0]}" -eq 0 || { echo "cargo failed — not packaging"; exit 1; } SO=target/aarch64-linux-android/debug/libapp_lib.so test -f "$SO" || { echo "no .so built"; exit 1; } echo "== strip $(date +%T)" DEST=src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a mkdir -p "$DEST" cp "$SO" "$DEST/libapp_lib.so" "$BIN/llvm-strip.exe" --strip-debug "$DEST/libapp_lib.so" ls -la "$DEST/libapp_lib.so" echo "== gradle $(date +%T)" cd src-tauri/gen/android ./gradlew.bat assembleArm64Debug -x rustBuildArm64Debug -q 2>&1 | grep -v "^$" | tail -20 || true cd /f/Coding/SoulStream APK=src-tauri/gen/android/app/build/outputs/apk/arm64/debug/app-arm64-debug.apk ls -la "$APK" echo "== done $(date +%T)"