无法使UiAutomator工作-类未出现,UiAutomator2驱动程序不存在

问题描述

我正在使用Idea和Android Studio,使用Appium编写测试,需要将UIautomator添加到我的项目中,我在build.gradle文件添加了依赖项语句。 编译组:“ androidx.test.uiautomator”,名称:“ uiautomator”,版本:“ 2.2.0-alpha4”

但是我看不到任何UI自动化器类

我还添加了以下功能功能。setCapability(“ automationName”,“ UiAutomator2”);

如何使用? UiDevice搜索一无所获

解决方法

在DesiredCapabilities中设置skipServerInstall = False,您将从appium中获得最新的UiAutomator2。测试成功运行了一次之后,您可以再次将其设置为True