Android Layout Inspector fails with timeout error

此生再无相见时 提交于 2020-01-03 07:21:11

问题


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?


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/56263347/android-layout-inspector-fails-with-timeout-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!