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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With