Skip to content

feat(app-expo): Windows-friendly Android dev scripts + environment doctor - #691

Open
k6G52m4Dz75W wants to merge 3 commits into
codedogQBY:mainfrom
k6G52m4Dz75W:feat/windows-android-onboarding
Open

feat(app-expo): Windows-friendly Android dev scripts + environment doctor#691
k6G52m4Dz75W wants to merge 3 commits into
codedogQBY:mainfrom
k6G52m4Dz75W:feat/windows-android-onboarding

Conversation

@k6G52m4Dz75W

Copy link
Copy Markdown
Contributor

Summary

On Windows, every expo:* npm script failed with
'APP_VARIANT' 不是内部或外部命令 because the scripts used Unix-style
APP_VARIANT=development pnpm ... env assignment, which cmd/PowerShell do not
support. This PR makes the mobile dev scripts work cross-platform and adds a
doctor script so Windows contributors can verify their Android toolchain in one
command.

Changes

  • cross-env: prefix all APP_VARIANT=... scripts (start, start:clear,
    android:dev, ios:*, eas:build:*) with cross-env (added as a
    devDependency) so they run in Windows PowerShell/cmd and keep working on
    macOS/Linux/CI.
  • scripts/check-android-env.ps1: a PowerShell doctor that checks
    Node/pnpm, JDK 17+, the Android SDK (platform-tools, platforms, build-tools,
    accepted licenses) and an emulator AVD / connected device. Prints [ OK ] /
    [FAIL] per item with concrete fix steps and exits non-zero on failure.
  • pnpm expo:doctor:android: new npm script + root alias to run the check.
  • Docs: added a "Windows: Android development setup" section to
    README.md / README_CN.md (JDK, Android Studio, SDK components, AVD, env
    vars, then pnpm expo:doctor:androidpnpm expo:start + pnpm expo:android).

Example output

ReadAny - Android dev environment check

[ OK ] Node.js
[ OK ] pnpm
[FAIL] JDK (JAVA_HOME=)
       > JAVA_HOME is not set. Install JDK 17/21 and set JAVA_HOME (...).
[ OK ] Android SDK (C:\Users\...\Android\Sdk)
[ OK ] platform-tools (adb)
[ OK ] Android SDK Platform (API 35+)
[ OK ] Android SDK Build-Tools
[ OK ] SDK licenses accepted
[FAIL] Android device/emulator connected
       > Start an emulator (Device Manager) or connect a device with USB debugging enabled.
[ OK ] Emulator AVD configured

8 passed, 2 failed

The npm scripts used Unix-style APP_VARIANT=development cmd env assignment,
which fails on Windows cmd/PowerShell ('APP_VARIANT' is not recognized). Prefix
them with cross-env (added as devDependency) so pnpm start / pnpm android
work cross-platform.
… doctor

- npm scripts used Unix-style APP_VARIANT=... which fails on Windows
  cmd/PowerShell. Prefix with cross-env (new devDependency) so pnpm
  expo:start / expo:android work cross-platform.
- Add scripts/check-android-env.ps1: a doctor that verifies Node/pnpm, JDK
  17+, Android SDK (platform-tools, platforms, build-tools, licenses) and an
  emulator/device, printing concrete fix steps and exiting non-zero on failure.
- Wire pnpm expo:doctor:android (app-expo doctor:android + root alias).
- Document the Windows Android setup in README.md / README_CN.md.
…'t swallow it

Under Continue=SilentlyContinue, PowerShell drops the
NativeCommandError records produced by 2>&1, so java -version came back empty
and the doctor reported "Could not read the JDK version". Merge java's stderr
at the OS level with cmd /c ... 2>&1 instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant