Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
The
MainActivity
gets leaked after the second time the orientation changes, but only after navigating to a new destination using thenavHostController
.A working project where this can be reproduced is available here .
These are the reproduction steps:
FooScreen
, that only contains aTopAppBar
and aButton
).Button
(it will load theBarScreen
, that only contains aTopAppBar
)At this point you should see
StrictMode
complaining about the leak inside the logcat:The LeakCanary notification should also be visible . This is the LeakCanary log:
Things I have noticed:
adb shell am start -d "template://bar" -a android.intent.action.VIEW
)I've also tried to use the Android Studio Profiled to investigate the leak, but I wasn't really successful. Here some screenshots:
This is the overview of the modules of the repro project: enter image description here
In short, the App only has the single Activity with no logic beside setting up the nav host. The navigation logic is inside the
core-navigation
. Each feature module provides UI and business logic. Currently there are 3 features with 1 screen each: Foo, Bar and Debug. Foo screen has only one button that leads to Bar screen. The leak happens inside Bar screen, if you rotate the device twice. It does not happen if you access Bar via Deeplink.