You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Android] After exiting with Back, reopening the app in the same process never fires launch again (9.1 regression, Angular apps stay dead and unstyled) #11572
[Android] After exiting with Back, reopening the app in the same process never fires launch again (9.1 regression, Angular apps stay dead and unstyled)
Environment
CLI: 9.1.1
@nativescript/core: 9.1.2 (also checked in 9.1.3)
@nativescript/android: 9.1.1
@nativescript/angular: 18.0.1 (21.2.0 relies on the same launch / exit events)
Device: Android 11 (any Android 10 or 11 device, where Back on the root activity finishes it)
Works in: @nativescript/core 9.0.17 + @nativescript/android 9.0.2
If the user leaves the app with the Back button and reopens it while the process is still alive, the Angular app never starts again. The last screen stays visible but has lost all component styles, and taps do nothing. Only killing the process brings it back.
What happens in core:
Back on the root activity finishes it. Since this is the last window, exit fires (application.android.js, activity destroyed callback).
@nativescript/angular handles exit by destroying the app module. During teardown it calls removeTaggedAdditionalCSS(styleTag), which removes every component style.
On reopen, a new activity is created and setActivityContent resolves content through Application._resolveWindowContent → resolveWindowContent.
resolveWindowContent only fires the legacy launch event while _launchBridgeConsumed is false. That flag is set to true the first time (and in notifyLaunch) and never reset, so launch doesn't fire again in this process.
@nativescript/angular only bootstraps in its launch handler, so the app is never bootstrapped again.
In 9.0.x, every new activity created without saved state fired launch again (createRootView(rootView, fireLaunchEvent)), so Angular bootstrapped again after exit.
Android 12 and newer don't finish the root activity on Back, so this is easiest to see on 10 or 11. Any path that finishes the last activity without killing the process should trigger it too.
Reproduction
Run the app on an Android 10 or 11 device or emulator.
Press Back on the first screen until the app closes. Don't swipe it away from recents, so the process stays alive.
Activity