Use this when Android native builds fail in your normal workspace because of long Windows paths.
This guide runs everything from a disposable copy at C:\e, then removes it at the end.
- Android Studio with:
- Android Emulator
- A phone AVD
- A Wear OS AVD
- Node + pnpm available in PowerShell
- Source repo available at
C:\dev\apps\eclipse-timer
Use Android Studio Device Manager to create more virtual devices.
- Open Android Studio.
- Go to
Tools->Device Manager. - Click
+->Create Virtual Device.
- In
Device Manager, switch to theWear OStab when choosing hardware. - Good options:
Pixel Watchfamily profilesPixel Watch 2orPixel Watch 3if available in your Android Studio version
- Choose a
Google APIssystem image (x86_64), preferably a recent API level. - Name the AVD clearly, for example:
Wear_Pixel_Watch_3_API_35
- In
Device Manager, use a standard phone profile (for examplePixel 8 Pro) or create a custom profile. - For a Samsung Galaxy S25 Ultra-like test device, create a custom hardware profile with approximate specs:
- Name:
Galaxy_S25_Ultra_Approx_API_36 - Screen size:
6.9" - Resolution:
1440 x 3120 - RAM/Storage: use practical emulator values supported by your machine
- Name:
- Then pick a
Google APIssystem image and finish creation.
Notes:
- Stock Android Emulator does not emulate Samsung One UI behavior exactly.
- Use a real Samsung device for vendor-specific UI behavior and OEM features.
- You can list all created AVDs with:
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$emu="$env:ANDROID_SDK_ROOT\emulator\emulator.exe"
& $emu -list-avdsRun in PowerShell:
$src = "C:\dev\apps\eclipse-timer"
$dst = "C:\e"
if (Test-Path $dst) {
Remove-Item $dst -Recurse -Force
}
New-Item -ItemType Directory -Path $dst | Out-Null
# Copy working files but skip heavy/generated folders.
robocopy $src $dst /E `
/XD .git node_modules apps\mobile\android\build apps\mobile\android\.cxx apps\mobile\.expo
# Robocopy uses non-zero success codes. 0-7 are success.
if ($LASTEXITCODE -gt 7) {
throw "robocopy failed with exit code $LASTEXITCODE"
}Set-Location C:\e
# Avoid deeply nested pnpm paths on Windows native Android builds.
"node-linker=hoisted" | Set-Content .npmrc
pnpm install --force$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$emu="$env:ANDROID_SDK_ROOT\emulator\emulator.exe"
& $emu -list-avds
& $emu -avd "Medium_Phone_API_36.1" -no-snapshot-loadReplace the sample AVD name with your exact name from -list-avds.
Keep this terminal open while the emulator runs.
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$emu="$env:ANDROID_SDK_ROOT\emulator\emulator.exe"
& $emu -list-avds
& $emu -avd "Wear_OS_XL_Round" -no-snapshot-loadReplace the sample AVD name with your exact name from -list-avds.
Keep this terminal open while the emulator runs.
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$adb="$env:ANDROID_SDK_ROOT\platform-tools\adb.exe"
& $adb devices -lSet variables from the output, for example:
$phone = "emulator-5554"
$watch = "emulator-5556"Set-Location C:\e
# Clear mismatched signatures if needed.
& $adb -s $phone uninstall com.lallimaven.eclipsetimer 2>$null
pnpm -C apps/mobile androidpnpm -C apps/mobile android stays running because Metro stays attached. That is expected.
$phone = "emulator-5554"
$watch = "emulator-5556"
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$adb="$env:ANDROID_SDK_ROOT\platform-tools\adb.exe"
Set-Location C:\e\apps\mobile\android
.\gradlew.bat :wear:assembleDebug
# Clear mismatched signatures if needed.
& $adb -s $watch uninstall com.lallimaven.eclipsetimer 2>$null
& $adb -s $watch install -r wear\build\outputs\apk\debug\wear-debug.apk
& $adb -s $watch shell am start -n com.lallimaven.eclipsetimer/com.lallimaven.eclipsetimer.wear.MainActivityUse Android Studio's Wear OS pairing assistant.
- Ensure both emulators are running and fully booted.
- Open Android Studio ->
Tools->Device Manager. - On either device row (phone or watch), click the overflow menu (
...) and choosePair Wearable. - In the pairing assistant, select the matching device and click
Next. - Wait while Android Studio prepares both emulators.
- If prompted on the phone emulator, install/open the
Wear OS by Googleapp from Play Store and complete setup prompts. - In the phone's Wear OS app, open the overflow menu and tap
Pair with emulator. - Accept pairing/association prompts that appear on phone/watch.
- Confirm pairing succeeded:
- Device Manager shows paired-device indicators.
- The watch and phone remain listed as paired after relaunch.
Recommended AVD compatibility for pairing assistant:
- Phone emulator: Android 11 (API 30) or newer, with Google Play image.
- Wear emulator: API 28 or newer.
Reopen the watch app and verify status progresses from waiting text to a phone reply.
If both phone and watch emulators are running, Expo may choose the wrong device unless you specify one.
Use explicit device targeting for the phone app:
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$adb="$env:ANDROID_SDK_ROOT\platform-tools\adb.exe"
& $adb devices -l
# Example phone serial:
$phone = "emulator-5554"
pnpm -C apps/mobile android -- --device $phoneIf ANDROID_SERIAL is set to a watch serial, clear it:
Remove-Item Env:ANDROID_SERIAL -ErrorAction SilentlyContinueIf you want to force phone targeting for the current terminal session:
$env:ANDROID_SERIAL = "emulator-5554"
pnpm -C apps/mobile androidUse this only for phone app runs. Clear/reset it before running watch-specific adb -s <watch-serial> ... commands.
Troubleshooting: react-native-screens:configureCMakeDebug[...] fails with missing prefab_command.bat
If the error shows a CreateProcess error=2 with a stale path under C:\dev\apps\eclipse-timer\...,
your disposable copy at C:\e is using an outdated React Native autolinking cache.
Regenerate autolinking from C:\e:
Set-Location C:\e\apps\mobile\android
cmd /c del /f /q build\generated\autolinking\autolinking.json
.\gradlew.bat :app:generateAutolinkingPackageList
pnpm -C C:\e\apps\mobile androidIf it still fails once, clear build outputs and retry:
cmd /c rmdir /s /q C:\e\apps\mobile\android\build
cmd /c rmdir /s /q C:\e\node_modules\react-native-screens\android\build
pnpm -C C:\e\apps\mobile androidAfter testing:
$env:ANDROID_SDK_ROOT="$env:LOCALAPPDATA\Android\Sdk"
$adb="$env:ANDROID_SDK_ROOT\platform-tools\adb.exe"
# Stop Metro/Expo terminal first (Ctrl+C), then stop emulators.
& $adb -s $phone emu kill
& $adb -s $watch emu kill
Set-Location C:\dev\apps\eclipse-timer
Remove-Item C:\e -Recurse -ForceAny edits made inside C:\e are discarded by design.