Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Layout Inspector fails with timeout error

Tags:

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:

1.

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.

2.

No active windows displayed by com.instabridge.android.dev

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?

like image 847
Simon Moshenko Avatar asked May 22 '19 19:05

Simon Moshenko


2 Answers

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.

UPDATE

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

like image 125
Simon Moshenko Avatar answered Sep 17 '22 22:09

Simon Moshenko


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.

like image 27
Matt Avatar answered Sep 17 '22 22:09

Matt