In Android Studio's Layout Inspector, how do you find which composables in a janky scrolling list recompose more often than they should?
answer
- how often, not how long
- recomposed versus skipped
- a toggle in Running Devices
- only debuggable foreground processes
basics
~20 sRun a debuggable build, open Layout Inspector from the Running Devices window, scroll the list and compare each composable's recomposition and skip counts; a row that keeps recomposing while rarely skipping is where to look.
solid answer
~50 sI run a debuggable build, because Layout Inspector connects to debuggable processes in the foreground, and click **Toggle Layout Inspector** in the **Running Devices** window. Layout Inspector can show, for each composable, how many times it was **recomposed** and how many times recomposition was **skipped**. I scroll the list and look for item composables whose recomposition count rises with every scroll while the skip count barely moves, or a parent that recomposes and drags every child with it. Then I select that composable, use **Show Only Subtree** to cut the noise, read its parameters in the **Attributes** panel and double-click to jump to the code. The counts say how often, not how long. Why the composable is not skipping is a Compose question, and whether those recompositions actually cost frames is something a system trace in the Profiler confirms.
go deeper
Recall how to open Layout Inspector from the Running Devices window and that it needs a debuggable app. Know the Component Tree and Attributes panels.
Explain recomposed versus skipped counts, what a climbing count on a list item means, and how Show Only Subtree and double-click navigation narrow the search.
Show the diagnostic order: counts to find where, a system trace to prove frame cost, and a re-check after the fix. Know that counts flag missing recompositions too.
Weigh where a team should look for recomposition problems: inspector sessions during development, frame-timing checks before release, or both, and who owns them.
## What Layout Inspector is **Layout Inspector** is Android Studio's tool for inspecting the UI of a **running** app on an emulator or physical device. It shows the live hierarchy in the **Component Tree**, the selected component's values in the **Attributes** panel, and a rendering of the screen in the **Layout Display**. It works with Compose, Views and hybrid layouts. For Compose it can also report **how often each composable is recomposed or skipped**, which is the part that matters for a janky list. Recomposition is Compose re-running a composable because its inputs may have changed; a **skip** is Compose deciding a composable's inputs are unchanged and not re-running it. The documentation calls out both failure directions: coding errors that force excessive recomposition and hurt performance, and errors that prevent recomposition so UI changes never appear. ## Opening it on the janky list 1. Run a **debuggable** build. Layout Inspector connects automatically to the debuggable processes running in the foreground of the connected device. 2. In the **Running Devices** window, click **Toggle Layout Inspector**. On a physical device, turn on device mirroring. 3. Leave **Deep Inspect** off while you scroll, because with it on, clicks select components instead of reaching the app. 4. Scroll the list the way a user would, then pause and read the counts. The inspector might need to restart the activity before attributes are available. ## Reading recomposition and skip counts - **High recompositions, few skips on a list item**: the item re-runs even when its data did not change. The usual causes, such as an unstable parameter or reading fast-changing state too high in the tree, are covered with Jetpack Compose. - **A parent recomposing on every scroll step** while its children follow: the state read sits too high, so one change fans out to every item. - **High skip counts**: these are good news. Skipping means Compose avoided work. - **Zero recompositions where the UI should have changed**: the opposite bug. The composable is not observing the state it displays. - **Compare relative numbers.** A header recomposing as often as the list scrolls is suspicious; an item recomposing once when it scrolls into view is expected. ## Narrowing it down - Select a component in the **Component Tree** or the **Layout Display**, and its values appear in **Attributes**. - Right-click and choose **Show Only Subtree** or **Show Only Parents** to isolate part of a deep list. **Show All** returns to the full view. - Turn **Deep Inspect** on and right-click a region to see every overlapping component there. - **Double-click** a component to jump to its code. - With **Live Edit** enabled, the inspector updates as you change the UI, so you can watch a count stop climbing after a fix. In the standalone (un-embedded) mode, turn on **Live Updates** instead. ## What counts cannot tell you | Question | Tool | |---|---| | Which composables re-run, and how often? | Layout Inspector's recomposition and skip counts | | How long did each frame take on the main thread and `RenderThread`? | a system trace in the Profiler, on a profileable release build | | Is garbage collection pausing frames? | the Profiler's memory tasks, on a debuggable build | Counts measure **frequency**, not **duration**. A cheap composable that recomposes often can be harmless, and one expensive recomposition can drop a frame by itself. Debuggable builds also carry overhead, so the inspector is for finding where to look, not for timing. ## A worked pass on the janky list 1. Scroll the list a few screens and stop. 2. In the Component Tree, expand the list and one visible item, and compare the item's counts with its children's. 3. If every item's count rises together, select the list's parent and check what it reads; one state read there can drive every item. 4. If only some items climb, select one, read its parameters in **Attributes**, and double-click to open the code. 5. Fix the cause in code, run again, repeat the same scroll and confirm the counts stay low. 6. Then confirm the frames improved with a system trace, because fewer recompositions do not prove a smoother list by themselves. ## Sharing what you found - **Snapshot Export/Import** saves the rendering, the Compose or View tree and every attribute, so a teammate can open the exact state you saw. - **Load Overlay** puts a mockup over the live layout with an **Overlay Alpha** slider, which helps with layout bugs more than with jank.
- Layout Inspector shows a row composable that never recomposes, yet its text should have changed after an update; what does that suggest?Layout Inspector flags both directions. Some coding errors prevent recomposition, so changes never reach the screen. A count that stays at zero while the data changed means the composable is not reading the state it displays; why that happens is a Compose question, but the inspector is where you notice it.
- Why can't recomposition counts alone prove that the list janks because of slow frames?Counts measure how often a composable re-ran, not how long it took, and the inspector needs a debuggable build with its own overhead. To prove a frame cost, record a system trace on a profileable release build and read frame durations on the main thread and `RenderThread`.
- How do you hand the inspection to a teammate who cannot reproduce the jank?Use Snapshot Export/Import to export a snapshot. It captures the rendered layout, the component tree and the attributes of every component, and your teammate imports it into their own Layout Inspector.
Recomposition counts are a pedometer, not a stopwatch: they tell you which composable keeps taking steps, but timing those steps is the system trace's job.
- Recomposition counts show how many milliseconds each composable took to run.
- Layout Inspector attaches to any release build, debuggable or not.
- A high skip count means the composable is wasting work.
- Layout Inspector only inspects Views, so it cannot help with Compose lists.
- If the recomposition counts look fine, the list cannot be janky.