My test automation saves screenshots as it runs for debugging purposes. I wanted also to save uix files so I could come back with uiautomatorviewer and load the structure to go with the screenshot. Unfortunately there didn’t seem to be a good way to save them without hacking into appium’s androidbootstrap jar. Doing an ‘adb uiatomator dump’ didn’t work as appium has a running uiautomator process and android doesn’t seem to permit two to be running concurrently.
In my efforts, I discovered that when appium generates pageSource, in the format that we all know and hate, it uses a tempfile in the uix format. It is merely a matter of grabbing that uix tempfile after doing a getPageSource!
An adb pull will get it for you:
adb pull /data/local/tmp/local/tmp/dump.xml savefile.uix