uiautomator
uiautomator copied to clipboard
adb.exe continues to run after program exit
Hello.
After running any python script using uiautomator there are still exist two processes 'adb.exe'. It looks like Adb() object runs adb-command through Popen that waits for .join() that never happen. It also blocks any commands input to cmd in very strange way: after writing any command and pressing ENTER nothing happens. Pressing ENTER second time returns to %your_dir%>
Here is a sample code to demonstrate:
# -*- coding: utf-8 -*-
from uiautomator import AutomatorDevice as Device
import json
import xmltodict
def getEmuInfo():
d = Device('emulator-5556', adb_server_host='127.0.0.1', adb_server_port=5037)
content = d.dump()
content = xmltodict.parse(content)
print(json.dumps(content, indent = 4))
return
getEmuInfo()
print "program finished"
Here is the output:
https://i.gyazo.com/ee584ee052a75d4e313257ea5c4025f1.png
The only possible workaround is to kill adb.exe process.
OS: Windows 7 Ultimate x64 ADB version: 1.0.39 (Version 27.0.0-4455170)
I have ran into this issue too. The symptom I ran into was that I could not launch uiautomatorviewer after running my tests. I was doing adb kill-server
and then adb start-server
to recover per this post: https://stackoverflow.com/questions/40214342/error-obtaining-ui-hierarchy-error-while-obtaining-ui-hierarchy-xml-file-com-an
Though I can confirm that adb.exe is still running, and killing it is what indeed fixes the issue.
The problem is uiautomator is conflict with uiautomatorviewer
Correct. My workaround is to call ‘device.server.stop’ upon test completion, which appears to shutdown adb connection