无法 运行 python(mac) 的自动化脚本

Not able to run automation script of python(mac)

我正在使用 https://github.com/appium/python-client 框架来 运行 自动化。

我在 运行ning 脚本时出现以下错误。

Exception: Message: An unknown server-side error occurred while processing the command. Original error: packageAndLaunchActivityFromManifest failed. Original error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

此外,我在 mac 上设置了 ANDROID_HOME 环境变量。

有人知道怎么解决吗?

此错误与您使用的库无关。请在终端中 运行 appium-doctor 并查看输出。应该是这样的

    info AppiumDoctor Appium Doctor v.1.4.3
    info AppiumDoctor ### Diagnostic starting ###
    info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
    info AppiumDoctor  ✔ Node version is 6.11.0
    info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
    info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
    info AppiumDoctor  ✔ DevToolsSecurity is enabled.
    info AppiumDoctor  ✔ The Authorization DB is set up properly.
    info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage
    info AppiumDoctor  ✔ HOME is set to: /Users/poornima
    info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/poornima/Library/Android/sdk
    info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
    info AppiumDoctor  ✔ adb exists at: /Users/poornima/Library/Android/sdk/platform-tools/adb
    info AppiumDoctor  ✔ android exists at: /Users/poornima/Library/Android/sdk/tools/android
    info AppiumDoctor  ✔ emulator exists at: /Users/poornima/Library/Android/sdk/tools/emulator
    info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
    info AppiumDoctor ### Diagnostic completed, no fix needed. ###
    info AppiumDoctor 
    info AppiumDoctor Everything looks good, bye!
    info AppiumDoctor 

如果不是

确保您的工具和平台工具也已添加到 bash 配置文件中的路径变量。

  1. 打开 bash 个人资料 open ~/.bash_profile

  2. 添加工具和平台工具

    export ANDROID_HOME=/Users/poornima/Library/Android/sdk
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    export PATH=$ANDROID_HOME/tools:$PATH
    

参考这个link: