同样的代码之前能正常进行,但是在对 app 卸载然后安装新版本后就一直报现在的错误:
WebDriverException: Message: UiAutomator died while responding to command, please check appium logs!

可以启动 app,但是也只能启动 app,一旦执行点击操作,就报错

已经做得尝试:
1.重启机器包括安卓机、电脑,问题仍然存在
2.安装之前能用的版本问题仍然一样
3.安卓版本 5.1.1 不存在 API 过低的问 http://www.cnblogs.com/nzyjlr/p/4494256.html
4.卸载安装 app,依然报错
5 修改代码,精简到 http://www.cnblogs.com/fnng/p/4579152.html 这个中的代码 仍然报错

附上 appium log 已经 pycharm 上的报错信息

appiumlog(package 名已经修改)
``` Checking if an update is available

Launching Appium server with command: D:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 22 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"22","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"201b49d4e302964a","browserName":"","version":"5.1.1","appPackage":"com.xxxx","platformName":"Android","appActivity":"com.xxxx.ui.screen.HomeActivity"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session b5c8ab08-744a-4c8b-9faa-927b8cf6cfca
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_91
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\android-sdk-windows\platform-tools\adb.exe
warn: No app capability, can't parse package/activity
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 201b49d4e302964a
info: [debug] Setting device id to 201b49d4e302964a
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a wait-for-device
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 22
info: Device API level is: 22
info: [debug] Extracting strings for language: default
info: [debug] Apk doesn't exist locally
info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "rm -rf /data/local/tmp/strings.json"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a push "D:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a install "D:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a install "D:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.xxxx -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
info: [debug] Getting device API level
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 22
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.xxxx/com.xxxx.ui.screen.HomeActivity"
info: [debug] Waiting for pkg "com.xxxx" and activity "com.xxxx.ui.screen.HomeActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "dumpsys window windows"
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "getprop ro.build.version.release"
info: [debug] Device is at release version 5.1.1
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId b5c8ab08-744a-4c8b-9faa-927b8cf6cfca
info: <-- POST /wd/hub/session 303 5215.249 ms - 74
info: --> GET /wd/hub/session/b5c8ab08-744a-4c8b-9faa-927b8cf6cfca {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"5.1.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"201b49d4e302964a","browserName":"","version":"5.1.1","appPackage":"com.xxxx","platformName":"Android","appActivity":"com.xxxx.ui.screen.HomeActivity"},"deviceName":"201b49d4e302964a","version":"5.1.1","appPackage":"com.xxxx","platformName":"Android","appActivity":"com.xxxx.ui.screen.HomeActivity"},"sessionId":"b5c8ab08-744a-4c8b-9faa-927b8cf6cfca"}
info: <-- GET /wd/hub/session/b5c8ab08-744a-4c8b-9faa-927b8cf6cfca 200 2.834 ms - 657 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"5.1.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"201b49d4e302964a","browserName":"","version":"5.1.1","appPackage":"com.xxxx","platformName":"Android","appActivity":"com.xxxx.ui.screen.HomeActivity"},"deviceName":"201b49d4e302964a","version":"5.1.1","appPackage":"com.xxxx","platformName":"Android","appActivity":"com.xxxx.ui.screen.HomeActivity"},"sessionId":"b5c8ab08-744a-4c8b-9faa-927b8cf6cfca"}
info: --> POST /wd/hub/session/b5c8ab08-744a-4c8b-9faa-927b8cf6cfca/element {"using":"id","sessionId":"b5c8ab08-744a-4c8b-9faa-927b8cf6cfca","value":"com.xxxx:id/edittextaccount"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.xxxx:id/edittextaccount","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.xxxx:id/edittextaccount","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.xxxx:id/edittextaccount using ID with the contextId: multiple: false
info: [debug] [UIAUTOMATOR STDOUT] [APPIUM-UIAUTO] [debug] Using: UiSelector[INSTANC
info: [debug] [UIAUTOMATOR STDOUT] E=0, RESOURCE_ID=com.xxxx:id/edittextaccount][/APPIUM-UIAUTO]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
info: [debug] [BOOTSTRAP] [error] Error processing data to/from socket (java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer))
info: [debug] UiAutomator exited
info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 201b49d4e302964a shell "echo 'ping'"
info: [debug] Attempting to uninstall app
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Cleaning up android objects
info: [debug] Condition unmet after 4523ms. Timing out.
info: [debug] Responding to client with error: {"status":13,"value":{"message":"UiAutomator died while responding to command, please check appium logs!","name":"UnknownError","origValue":"UiAutomator died while responding to command, please check appium logs!"},"sessionId":"b5c8ab08-744a-4c8b-9faa-927b8cf6cfca"}
info: [debug] Cleaning up appium session
info: <-- POST /wd/hub/session/b5c8ab08-744a-4c8b-9faa-927b8cf6cfca/element 500 4525.720 ms - 266
info: --> POST /wd/hub/session/b5c8ab08-744a-4c8b-9faa-927b8cf6cfca/element
t ```

pycharm:

Traceback (most recent call last):
  File "E:\Appiumtest\test_case\jxxxxa.py", line 50, in test_001login
    login.login(self)
  File "E:\Appiumtest\test_case\public\login.py", line 14, in login
    name31 = self.driver.find_element_by_id('xxxxxxx:id/edittextaccount')
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 269, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 745, in find_element
    {'using': by, 'value': value})['value']
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
    raise wde
WebDriverException: Message: UiAutomator died while responding to command, please check appium logs!```


↙↙↙阅读原文可查看相关链接,并与作者交流