diff --git a/codemagic.yaml b/codemagic.yaml index a993c13..fb75c03 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -231,12 +231,26 @@ workflows: - name: Build the debug APK script: | + set -e cd mobile/android chmod +x ./gradlew # Debug build type is auto-signed with the Android debug keystore → directly installable, no Play # account or upload key needed. (A signed release AAB for the Play Store is a later, separate step.) - ./gradlew assembleDebug --stacktrace + # Capture the output so that, on failure, we surface Gradle's actual "What went wrong" block instead + # of a wall of internal stack frames — and FAIL the step (a trailing `find` used to exit 0 and mask it). + set +e + ./gradlew assembleDebug --stacktrace 2>&1 | tee /tmp/gradle.log + STATUS=${PIPESTATUS[0]} + set -e + if [ "$STATUS" != "0" ]; then + echo "======================= GRADLE FAILURE =======================" + grep -n -A 25 "What went wrong" /tmp/gradle.log || true + grep -n -A 3 "FAILURE:" /tmp/gradle.log || true + echo "==============================================================" + exit 1 + fi echo "APK(s):"; find app/build/outputs -name "*.apk" + test -n "$(find app/build/outputs -name '*.apk' -print -quit)" || { echo "ERROR: no APK produced"; exit 1; } artifacts: - mobile/android/app/build/outputs/**/*.apk # Download the APK from the build page. To get it emailed like TestFlight, add a `publishing.email` block