$ErrorActionPreference = 'Stop' Write-Host '=== 安装并启动 RN Test Host ===' $root = Split-Path $PSScriptRoot -Parent $apk = Join-Path $root 'android\app\build\outputs\apk\debug\app-debug.apk' if (-not (Test-Path $apk)) { throw '请先执行 03-build-debug.ps1' } $device = '192.168.1.146' adb -s $device get-state adb -s $device reverse tcp:8091 tcp:8091 adb -s $device reverse tcp:8081 tcp:8091 adb -s $device install -r $apk if ($LASTEXITCODE -ne 0) { throw 'APK 安装失败' } $pkg = 'org.maplibre.particle.rntesthost' adb -s $device shell am force-stop $pkg adb -s $device shell am start -n "$pkg/.MainActivity" Write-Host '已启动。Metro 应在另一个窗口监听 8091。' Write-Host '若开发客户端显示服务器列表,请选择本机 8091 的 development server。'