具体 python 代码:

from appium import webdriver

desired_caps = {}
desired_caps['platformName'] = 'Android'

desired_caps['platformVersion'] = '9'

desired_caps['deviceName'] = 'PCT-AL10'

desired_caps['appPackage'] = 'com.cloudmagic.magiclive'

desired_caps['appActivity'] = 'com.yizhibo.video.activity.HomeTabActivity'

desired_caps['unicodeKeyboard'] = True

desired_caps['resetKeyboard'] = True

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

error 报错信息:

Encountered internal error running command: Error: Cannot start the 'com.cloudmagic.magiclive' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'E:\android-sdk-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 5ENDU19426003672 shell am start -W -n com.cloudmagic.magiclive/com.yizhibo.video.activity.HomeTabActivity -S' exited with code 4294967295'; Stderr: 'Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.cloudmagic.magiclive/com.yizhibo.video.activity.HomeTabActivity } from null (pid=14671, uid=2000) not exported from uid 10249


↙↙↙阅读原文可查看相关链接,并与作者交流