$ErrorActionPreference = 'Stop' . (Join-Path $PSScriptRoot 'android-env.ps1') $taskImagePath = Join-Path $env:ANDROID_HOME 'system-images/android-36/google_apis/x86_64/system.img' if (-not (Test-Path -LiteralPath $taskImagePath)) { throw 'Run setup-android-sdk.ps1 -WithEmulator first.' } $taskAvdName = 'hepan_everyday' $taskAvdConfig = Join-Path $env:ANDROID_AVD_HOME "$taskAvdName.avd/config.ini" if (Test-Path -LiteralPath $taskAvdConfig) { Write-Output "Emulator $taskAvdName already exists." exit 0 } New-Item -ItemType Directory -Force -Path $env:ANDROID_AVD_HOME | Out-Null 'no' | & avdmanager.bat create avd --name $taskAvdName --package 'system-images;android-36;google_apis;x86_64' --device 'pixel_7' if ($LASTEXITCODE -ne 0) { throw 'Android virtual device creation failed.' } Write-Output "Created $taskAvdName (Pixel 7, Android 16)."