Android Layout Inspector fails with timeout error-ThrowExceptions

Exception or error:

When I try to inspect my application’s layout in a simulator, by going Tools => Layout Inspector, it always fails with one of the errors:


Error obtaining view hierarchy: There was a timeout error capturing the layout data from the device.
The device may be too slow, the captured view may be too complex, or the view may contain animations.

Please retry with a simplified view and ensure the device is responsive.


No active windows displayed by

The layout is not particularly complex, and it does not contain animations, just map with some views. Android Studio is 3.4.1. How do I fix it? Or how to find the cause of the errors?

How to solve:

Found a really strange solution.

Open your app, go to android home screen, open another app, now use Layout inspector in Android Studio.

It worked and I see my app’s view hierarchy.


P.Melch claims that you don’t even need to open another app, try just sending your app to background.


I had the same issue on Android Studio 3.4, but I was able to use the Layout Inspector on Android Studio 3.5 Beta 1 without any problems.

I am working with a very complex view, so I suspect that is what led to the trouble on Android Studio 3.4. Both the failure I saw and the success were with a physical device.


Try to use a real device instead of the simulator.
When running the simulator and android studio, your laptop/mac/whatever might be running out of memory.

I always prefer to run the layout inspector on a real physical device. It works the same as with the emulator once you’re connected with adb

Leave a Reply

Your email address will not be published. Required fields are marked *