Connecting Android Studio Layout Inspector to an app on a foldable device can make the inspected app display “Application Not Responding (ANR).” This is a known tooling bug, so first determine whether the freeze occurs only while Layout Inspector is attached instead of assuming that the app itself is doing excessive work.
Representative diagnostic
Application Not Responding (ANR)
ANR in <your.package.name>
Depending on the device and Android version, the system dialog may say “App isn’t responding.” Google’s issue describes a deadlock in which the Layout Inspector agent’s FoldSupport blocks the main thread while holding the ViewLayoutInspector state lock.
Cause
The Layout Inspector agent’s fold-state handling can conflict with synchronization of the inspector state. The main thread remains blocked long enough for Android to classify the inspected app as unresponsive. In this specific bug, the app normally runs until Layout Inspector attaches and begins inspecting it.
Affected conditions and versions
- Layout Inspector is attached to a running application.
- The target is a foldable device or otherwise exercises fold-state handling.
- The Android Studio build predates Rabbit 1 Canary 4 and contains the affected inspector implementation.
Google lists Issue #550505817 as fixed in Android Studio Rabbit 1 Canary 4. That release was bundled with AGP 9.5.0-alpha04, but this is a Layout Inspector fix. Updating AGP alone is not a substitute for updating Android Studio.
Recommended resolution
- Disconnect Layout Inspector: Stop inspection, force-stop the affected app, and launch it normally.
- Confirm the trigger: Verify that the same workflow succeeds without the inspector and freezes only after it attaches.
- Update Android Studio: Install Rabbit 1 Canary 4 or a later release that includes the fix.
- Restart the IDE and target: Close Android Studio and restart the app or device as needed so an older inspector-agent session is not retained.
- Retest inspection: Attach to the same screen on the same foldable and exercise fold-state changes and normal UI interactions.
Important: Rabbit 1 Canary 4 is the first version in which Google lists the fix. If your team requires stable-channel builds, use the workaround until a later approved release containing the fix is available.
Workarounds
- Avoid Layout Inspector on the affected device and use logs, screenshots, or Compose Preview where appropriate.
- Inspect the equivalent layout on a non-foldable device or emulator when that still reproduces the UI you need to analyze.
- Keep inspection sessions short and disconnect immediately if the app begins to stop responding.
These measures only avoid the trigger; updating Android Studio is the official fix.
How to verify the fix
- Open Help → About, or Android Studio → About Android Studio on macOS, and confirm the installed version.
- Run the same workflow without Layout Inspector and confirm that it remains responsive.
- Attach Layout Inspector in the fixed IDE and interact with the app, including fold-state changes.
- Confirm that neither the ANR dialog nor an
ANR in <package>diagnostic returns.
Cautions
ANRs have many other causes, including long main-thread I/O, application lock contention, expensive rendering, and component timeouts. If the app freezes during ordinary execution without Layout Inspector, do not attribute it to this issue. Analyze the ANR trace from Play Console, Perfetto, or the device trace and inspect the application’s main thread.
Summary
The foldable-device ANR triggered by Layout Inspector is a known deadlock in the inspector agent. Update to Android Studio Rabbit 1 Canary 4 or later. Until an approved build containing the fix is available, disconnect Layout Inspector and use an alternative inspection method.
