Uiautomatorviewer 获取 UI 层次结构 XML 文件时出错:com.android.ddmlib.SyncException:远程对象不存在

问题描述 投票:0回答:2

我可以成功启动 Uiautomatorviewer,检查个人资料中的任何页面/应用程序。

一旦手机处于工作配置文件/启动工作配置文件下安装的任何应用程序,Uiautomatorviewer 就会抛出错误:

Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

我不知道为什么它突然会这样,上周无论个人/工作资料如何它都可以工作。 我不记得我更改过任何配置...

请帮忙给我线索为什么?我遵循了许多以前的帖子建议来重新启动 adb 服务器、终止 appium 服务器、重新启动手机/笔记本电脑、禁用启用开发人员选项...等。没有一个有效....

我现在尝试检查个人资料,发生了同样的错误:

Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

更新:我使用了 Appium Studio Inspector 并且它有效。我仍然不确定 adb 或 uiautomator 通过命令行发生了什么?我该如何调试它?

adb android-uiautomator
2个回答
1
投票

找到答案

com.android.ddmlib.SyncException:是一个目录

try doing adb shell rm -rf /data/local/tmp and rebooting the phone first. it's ok if you get rm: /data/local/tmp: Permission denied. ignore it - it's for the tmp folder itself after its content was already removed (that's what you need anyway)

0
投票
  1. 通过npm安装appium和uiautomator2驱动

当我在Windows 10上安装Appium时,它有一些错误。当你按照教程所述运行'appium driver install uiautomator2'时,会跳出错误'EINVAL'(我猜由于npm版本存在一些参数问题)。那么你最好使用'npm install -g appium-uiautomator2-driver'。之后,将目录“appium-uiautomator2-driver”复制到“C:\Users\XXX\AppData\Roaming”中 下午 ode_modules' 到 'C:\UsersP86.appium ode_modules' 并将刚刚复制到 'C:\UsersP86.appium' 的目录中的 'package.json' 复制到 'C:\UsersP86.appium'。

  1. 在控制台中运行“appium”

enter image description here

  1. 运行uiautomatorviewer.bat

  2. 只需截图即可。现在应该可以了

安装appium:https://appium.io/docs/en/latest/quickstart/install/

© www.soinside.com 2019 - 2024. All rights reserved.