Appium 求问各路大神!脚本启动不了安卓真机,使用各路方法后无果

AllisonLiu · 2019年07月10日 · 最后由 cmlanche 回复于 2019年07月14日 · 2043 次阅读
def desired_caps():

    with open("../config/toolkit_caps.yaml", 'r', encoding='utf-8') as f:
        data = yaml.load(f)

    des_caps = {
        'platformName': data['platformName'],
        'platformVersion': data['platformVersion'],
        'deviceName': data['deviceName'],
        'uid': data['uid'],
        'appPackage': data['appPackage'],
        'appActivity': data['appActivity']
    }
    logging.info("============ Start the nio mate app ============")
    print("!!!IS CONNECTING!!!")
    driver = webdriver.Remote("http://" + str(data['ip']) + ":" + str(data['port']) + "/wd/hub", des_caps)
    time.sleep(5)
    print("!!!Connected!!!")
    return driver

上脚本:

配置 capacity

启动 Appium 服务器后,脚本的 console 报错信息如下:

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: Command '/usr/local/android-sdk-macosx/platform-tools/adb -P 5037 -s 634f5ff9 install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk' exited with code 1{"stdout":"","stderr":"adb: failed to install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\n","code":1}

我在网上查到的相关信息是 appium 版本与 android 7 系统存在不适配的情况。
请问大佬们有没有碰到过相关问题,和相对应的解决方法呢?

版本号情况:

Appium:v1.5.3
Selenium: 3.141.0
Python: 3.7
Android:7.1.1

共收到 7 条回复 时间 点赞

appium 日志是什么

2楼 已删除

执行任务过程中,设备闪断吧:
getprop ro.build.version.release' exited with code 1{"stdout":"","stderr":"error: device '7391c4a8' not found\n","code":1

作为一个不会用 ap...的人

  • The following capabilities were provided, but are not recognized by appium: uid. , 所以 des_caps 还是写的有问题
  • adb -P 5037 -s 7391c4a8 shell getprop ro.build.version.release 是报错的,单独执行下,你看看为啥报错
cmlanche 回复

不好意思,日志贴错了。是:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: Command '/usr/local/android-sdk-macosx/platform-tools/adb -P 5037 -s 634f5ff9 install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk' exited with code 1{"stdout":"","stderr":"adb: failed to install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\n","code":1}

hellohell 回复

日志贴错了,日志是:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: Command '/usr/local/android-sdk-macosx/platform-tools/adb -P 5037 -s 634f5ff9 install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk' exited with code 1{"stdout":"","stderr":"adb: failed to install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\n","code":1}

AllisonLiu 回复

不是写的很清楚吗错误,io.appium.settings 已存在,INSTALL_FAILED_ALREADY_EXISTS

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册