Loading...
Loading...
Build debug APK cho app Expo/React Native trên GitHub Actions (gradle trực tiếp, không EAS token) — push code lên branch build rồi tải APK debug về để test lỗi thật trên máy. Áp dụng chung cho MỌI project Expo/RN. Dùng khi user yêu cầu "build apk", "tải apk test", "thấy lỗi trên máy thật", "push build gh actions".
npx skill4agent add hoangsoft90/ai_skills expo-build-debug-apk-ghassembleDebuglocalhost:8081Unable to load script ... Make sure you're running Metroreact {}android/app/build.gradleexpo-apk-standaloneReactExtension.ktbundleInDebug = truedebuggableVariants = []cd <project> # vd: apps/mobile
npx expo prebuild --platform android --no-install
# PHẢI thấy debuggableVariants = [] (hoặc bundleInDebug = true theo RN version):
grep -n -A4 "react {" android/app/build.gradle
# PHẢI thấy applicationId + app_name đúng:
grep -n "applicationId" android/app/build.gradle
grep -n "app_name" android/app/src/main/res/values/strings.xmlEXPO_PUBLIC_*https://placeholder.supabase.coprocess.env.EXPO_PUBLIC_*.envEXPO_PUBLIC_*env:env:
EXPO_PUBLIC_SUPABASE_URL: ${{ secrets.EXPO_PUBLIC_SUPABASE_URL || 'https://<project-ref>.supabase.co' }}
EXPO_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.EXPO_PUBLIC_SUPABASE_ANON_KEY || 'eyJ...' }}
# ... mọi EXPO_PUBLIC_* khác (AdMob unit IDs, API public, v.v.)EXPO_PUBLIC_*secrets.X || 'fallback'# Workflow có đủ EXPO_PUBLIC_* cho app không?
grep -n "EXPO_PUBLIC_" .github/workflows/<build>.yml
# Mọi biến app đọc đều có trong workflow env (không chỗ nào rơi vào placeholder)# APK có chứa placeholder/URL sai không?
strings app-debug.apk | grep -iE "placeholder|localhost|http://" | head
# Đối chiếu với URL backend thật của projectcd <project>
npx tsc --noEmit # typecheck
npm run lint # lint
npx jest # test
npx expo export --platform android 2>&1 | tail -2 # bundle checkcd <project-root>
git add -A
git commit -m "message"
git push origin <branch> # workflow trigger tự độngcurl -s -H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/<owner>/<repo>/actions/runs?per_page=3"# Lấy artifact download URL:
curl -s -H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/<owner>/<repo>/actions/artifacts" | python3 -m json.tool
# Download + giải nén:
curl -sL -H "Authorization: Bearer $GH_TOKEN" -o apk.zip "<archive_download_url>"
unzip -o -q apk.zip && ls -lh *.apk<tên-artifact>app-debug.apk./gradlew assembleDebugandroid/app/build/outputs/apk/debug/app-debug.apknpm ciexpo prebuild --platform android --clean --no-installgradlew assembleDebugenv:EXPO_PUBLIC_*gh-actions-expo-apk-buildreact {}npx expo exportassembleDebugassembleReleaseapk/release/app-release.apkgh-actions-expo-apk-build