I try to get the current UI-Layout as xml. I already found out that there is a tool called "UI Automator" and there is also an adb command to get the layout as XML adb shell uiautomator dump.
There are two problems with the command and tool. Firstly, it can't pick up a layout when the structure changes very quickly (an error message appears ERROR: null root node returned by UiTestAutomationBridge.) and secondly, there is also a bug where sometimes an error occurs when querying the layout. And it is terribly slow (about 2s).
Now I found a newer tool in Android Studio called "Layout Inspector" (under the tools section) that don't have these issues (instant xml response, no problem with fast layouts and no random errors). The problem is that I can't find any adb command (the tool only works when a device is available over adb) to get the xml structure manually. I also found out that there are some apps that behave same (e.g. Developer Assistant).
So how can I get the current Layout without UiAutomator over adb?