Appium 环境已经搭建成功后,连接 Android 真机,写了一个打开手机 Settings 这个应用的 python 脚本。然后运行报错,无法打开 Settings 应用。脚本内容如下:
from appium import webdriver
desired_caps = {}
desired_caps['automationName'] = 'UiAutomator2'
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '6.0'
desired_caps['deviceName'] = 'HUAWEI MT7-CL00'
desired_caps['udid'] = 'G2W0214922003906'
desired_caps['appPackage'] = 'com.android.settings'
desired_caps['appActivity'] = '.HWSettings'
browser = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
Appium 报错日志:
Python 脚本报错日志:
Traceback (most recent call last):
File "E:/Study/appauto.py", line 14, in <module>
browser = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
File "D:\Python\lib\site-packages\appium\webdriver\webdriver.py", line 144, in __init__
proxy
File "D:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "D:\Python\lib\site-packages\appium\webdriver\webdriver.py", line 219, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, parameters)
File "D:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\Python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: zipAlignApk failed. Original error: Command ''D:\\Android SDK Tools\\build-tools\\29.0.2\\zipalign.exe' -f 4 C:\\Users\\Cww03\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk C:\\Users\\Cww03\\AppData\\Local\\Temp\\20191111-4600-jdyhkf.bntmh\\appium.tmp' exited with code 1. Stdout: ''; Stderr: 'Unable to open 'C:\Users\Cww03\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' as zip archive
'
Appium 版本及环境
Android SDK 版本
各位大佬们,Google 没找到答案。哪位同学遇到过相同相似的问题的,能否指导一下,万分感谢!!