求助:appium环境报错:appium-uiautomator2-server-debug-androidTest.apk无法启动--已解决

Appium-windows-1.15.1.exe
sdk:24.4.1

appium-server存在多次安装的情况,运行下面代码:

from appium import webdriver

desired_caps = {}
desired_caps['platformName'] = 'Android'  # 设备系统
desired_caps['platformVersion'] = '7.1.2'
desired_caps['deviceName'] = '127.0.0.1:62001'  # 设备名称
desired_caps['appPackage'] = 'com.android.settings'
desired_caps['appActivity'] = 'com.android.settings.Settings'

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)  # 启动app
driver.quit()


报如下错误,查看模拟器上安装了uiautomator2-server,应该是启动有问题,在错误路径下,找到指定apk,也无法安装。

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘D:\software\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62001 install -r C:\Users\lihh\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk’ exited with code 1’; Stderr: ‘adb: failed to install C:\Users\lihh\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1830101756.tmp/base.apk: META-INF/CERT.SF has invalid digest for javax/annotation/meta/Exclusive.java in /data/app/vmdl1830101756.tmp/base.apk]’; Code: ‘1’

关闭