dotnet/maui · error · Exception
The emulator did not finish booting in time.
Error message
The emulator did not finish booting in time.
What it means
Thrown when the emulator boot-watchdog loop exceeds EmulatorBootTimeoutSeconds (10 minutes) without sys.boot_completed reporting '1'. Each second the loop checks SafeAdbShell('getprop sys.boot_completed'); if the counter passes the budget it aborts. At 90s in CI it also tries restarting the ADB server to recover from auth issues.
Source
Thrown at eng/devices/android.cake:769
{
settings.Serial = DEVICE_UDID;
}
if (waitForBoot)
{
Information("Waiting for the emulator to finish booting...");
// Wait for the emulator to finish booting
var waited = 0;
var total = EmulatorBootTimeoutSeconds;
while (SafeAdbShell("getprop sys.boot_completed", settings).FirstOrDefault() != "1")
{
System.Threading.Thread.Sleep(1000);
Information("Waiting {0}/{1} seconds for the emulator to boot up.", waited, total);
if (waited++ > total)
{
throw new Exception("The emulator did not finish booting in time.");
}
// At 90 seconds, restart ADB server to recover from authorization issues
if (waited == 90 && IsCIBuild())
{
Information("Emulator boot taking longer than expected (90/{0} seconds). Restarting ADB server...", total);
try
{
Information("Stopping ADB server...");
AdbKillServer(settings);
System.Threading.Thread.Sleep(2000);
Information("Starting ADB server...");
AdbStartServer(settings);
System.Threading.Thread.Sleep(2000);
Information("ADB server restart completed. Continuing to wait for emulator boot...");
}View on GitHub (pinned to f377ff1c5e)
Solutions
- Ensure hardware acceleration is enabled (Hypervisor Framework on macOS, KVM on Linux, Hyper-V/WHPX on Windows) — without it boot can exceed 10 min.
- Wipe the AVD data/cold-boot: delete the snapshot or recreate the AVD to clear corruption.
- Increase EmulatorBootTimeoutSeconds for slow agents, or allocate more RAM/CPU to the emulator.
- Watch the 90-second ADB-restart log line; if it appears, the issue is likely ADB authorization — ensure ADB keys are set up (see ADB key errors).
- Check emulator logs (e.g. ~/.android/avd/<name>.avd/logs) for the underlying hang.
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm emulator is reachable before boot-watchdog
if (!SafeAdbShell("getprop sys.boot_completed", settings).Any()) {
Warning("Emulator not responding to adb; boot watchdog may time out.");
} Try / catch
for (int bootAttempt = 1; bootAttempt <= 2; bootAttempt++) {
try {
WaitForEmulatorBoot(settings, EmulatorBootTimeoutSeconds);
break;
} catch when (bootAttempt < 2) {
Warning("Boot timed out; wiping AVD data and retrying.");
WipeAndRestartEmulator(settings);
}
} Prevention
- Enable hardware acceleration on all agents that run the emulator.
- Use warm/snapshotted AVDs to cut boot time under the budget.
- Surface emulator logs in CI when the watchdog throws for post-mortem.
When it happens
Trigger: The emulator fails to reach sys.boot_completed=1 within 600 seconds. Causes include slow/emulator-starved hosts, AVD stuck on boot animation, disk image corruption, HAXM/Hyper-V/KVM acceleration unavailable, or ADB authorization blocking the device.
Common situations: Underpowered CI agents without hardware acceleration; a corrupted AVD snapshot; cold boot of a large API-level image; ADB key authorization pending; emulator process hung.
Related errors
- All key generation methods failed. Unable to create ADB keys
- ADB keys were not created successfully.
- Failed to push ADB keys after multiple attempts.
- Environment variable 'ANDROID_SDK_ROOT' or 'ANDROID_HOME' mu
- JAVA_HOME environment variable isn't set. Set it to your JDK
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/fcd8bb012fb45ab8.
Report an issue: GitHub.