From 35ce641046093c5461d1d69b4faf5b2727ca38f6 Mon Sep 17 00:00:00 2001 From: sravan Date: Tue, 8 Sep 2026 16:08:52 +0530 Subject: [PATCH] Android CI: run on mac_mini_m2 (linux_x2 not on the billing plan) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The android-apk workflow requested linux_x2, which Codemagic rejected with "selected instance type is not available with the current billing plan". Switch to mac_mini_m2 — the same instance the iOS workflow already uses on this account; Codemagic's macOS images include the Android SDK + JDK. Also make the SDK path (ANDROID_SDK_ROOT -> ANDROID_HOME fallback) and the google-services base64 decode (GNU --decode / BSD -D) portable to the macOS image. Co-Authored-By: Claude Opus 4.8 --- codemagic.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 522e7c3..a993c13 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -172,7 +172,9 @@ workflows: # needed to test: download the APK artifact from the Codemagic build page (or wire an email/Slack in the # UI), sideload it on a phone (enable "Install unknown apps"), and run. # - # Runs on a Linux instance (has the Android SDK + JDK preinstalled) — much cheaper/faster than a Mac. + # Runs on the SAME macOS instance as the iOS workflow (mac_mini_m2) — Codemagic's macOS images ship the + # Android SDK + JDK too. (A Linux instance would be cheaper/faster but linux_x2 isn't on every billing + # plan; mac_mini_m2 is the one this account already uses for iOS.) # # Firebase push (FCM) is OPTIONAL for this test build: app/build.gradle only applies the google-services # plugin when google-services.json is present, so the APK builds fine WITHOUT it (push/call-wake just @@ -181,7 +183,7 @@ workflows: android-apk: name: Biz Connect Android → test APK max_build_duration: 45 - instance_type: linux_x2 + instance_type: mac_mini_m2 environment: # To enable FCM push later, create a Codemagic variable group holding GOOGLE_SERVICES_JSON (base64 of # google-services.json, marked secure) and uncomment the two lines below. Left out for now so the first @@ -207,10 +209,11 @@ workflows: npx cap sync android # App icon + splash from resources/icon.png & resources/splash*.png. npx capacitor-assets generate --android || echo "capacitor-assets returned non-zero (see above)" - # The generated project points sdk.dir at wherever it was made; overwrite it with the CI SDK path - # (Codemagic exports ANDROID_SDK_ROOT) so Gradle finds the SDK. - echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties - echo "Android SDK -> $ANDROID_SDK_ROOT" + # The generated project points sdk.dir at wherever it was made; overwrite it with the CI SDK path so + # Gradle finds the SDK. Codemagic exports ANDROID_SDK_ROOT (fall back to ANDROID_HOME on macOS images). + SDK="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}" + echo "sdk.dir=$SDK" > android/local.properties + echo "Android SDK -> $SDK" # android/ is gitignored and regenerated fresh in CI, so its manifest only has INTERNET. Inject the # camera/mic/notification permissions the web UI needs (mirrors ios-patch.sh for iOS). Tolerant + idempotent. node scripts/android-patch.js android/app/src/main/AndroidManifest.xml @@ -219,7 +222,8 @@ workflows: script: | cd mobile/android/app if [ -n "$GOOGLE_SERVICES_JSON" ]; then - echo "$GOOGLE_SERVICES_JSON" | base64 --decode > google-services.json + # Portable decode: GNU coreutils uses --decode/-d, BSD/macOS base64 uses -D. + echo "$GOOGLE_SERVICES_JSON" | { base64 --decode 2>/dev/null || base64 -D; } > google-services.json echo "google-services.json written — FCM push enabled in this build" else echo "No GOOGLE_SERVICES_JSON set — building WITHOUT FCM push (fine for a shell/UI test build)"