From 04e78205dd7c5897c7445529bc1382dac665b8b3 Mon Sep 17 00:00:00 2001 From: TMC Date: Thu, 12 Nov 2026 14:57:49 +0100 Subject: [PATCH] Release script: do not take Android's own crash during an APK swap for the app's When the release build is the emulator's home app, Android restarts it while the files are still being replaced, and that start can fail inside ActivityThread.handleBindApplication. The start-up check now waits for the swap to settle, stops the app, and judges a fresh start. Co-Authored-By: Claude Fable 5.2 --- flexera/release.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flexera/release.ps1 b/flexera/release.ps1 index d0eaf780b0..5a2a7a7bab 100644 --- a/flexera/release.ps1 +++ b/flexera/release.ps1 @@ -211,6 +211,13 @@ if ($NoSmokeTest) { if ($LASTEXITCODE -ne 0 -or -not ($install -match 'Success')) { throw "Could not install the APK on $emulator. If an older build signed with another key is installed there, uninstall it first: adb uninstall $AppId" } + # When this app is the emulator's home app, Android restarts it the moment the old copy is + # gone, and that first start can die inside Android itself while the files are still being + # swapped (a NullPointerException in ActivityThread.handleBindApplication, with no line of + # this app in it). That is not the new build crashing: let the swap settle, then start + # from a clean slate and judge what happens from there. + Start-Sleep -Seconds 6 + & $Adb -s $emulator shell am force-stop $AppId & $Adb -s $emulator logcat -b crash -c & $Adb -s $emulator shell am start -n $HomeActivity | Out-Null Write-Host "Installed on $emulator and started; watching for $SmokeTestSeconds seconds..."