Appium 找不到 aapt "Please set the ANDROID_HOME environment variable with the Android SDK root directory path."

标签 appium aapt

长期读者第一次海报。

我正在尝试在 Mac OS 10.9.5 上设置 Appium。我已将 .profile 中的 ANDROID_HOME 设置为以下内容:

export ANDROID_HOME=/Users/jfish/Documents/android-sdk-macosx

当尝试启动 Appium 时,我收到以下错误:

error: Failed to start an Appium session, err was: Error: Could not find aapt. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

但是我指定了正确的文件路径。我需要将构建工具添加到我的 $PATH 中吗?目前我只在那里指定了平台工具和工具。

我已尝试按照建议将 aapt 复制并粘贴到工具文件夹中 this问题,但无济于事。

感谢您抽出时间,如果这个问题在其他地方得到了回答,我很抱歉重复这个问题。我在 Google 和此处都找不到满意的答案。

最佳答案

遇到类似错误后,我想在解决方案中添加一些细节。如果您知道您拥有所有正确的路径变量,这可能会有所帮助。

我最终从命令行运行了 Appium,这样我就可以确认它认为我的环境变量是什么。 documentation说它会检查 ~/.bashrc、~/.bash_profile 和 ~/.zshrc 中的路径,我的路径在 bashrc 中,并且可以正确地回应自动化项目内部的路径。然而,在我运行 Appium 的终端环境中运行 echo $PATH 只显示了我的 bash_profile 中的内容!为了解决这个问题,我添加了

if [ -f ~/.bashrc ];然后 来源 ~/.bashrc fi

(来源:Here under "Recommendation")到我的 bash_profile 以确保它也可以访问 bashrc 中的路径,用 echo 确认,并重新启动服务器,然后它正确运行。

(如果有帮助,运行 mac 并使用 Python 3)

关于Appium 找不到 aapt "Please set the ANDROID_HOME environment variable with the Android SDK root directory path.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27452343/

相关文章:

selenium - 无法让移动版网站在 WebdriverIO 中呈现

java - 框架抛出错误: can not set io. appium.java_client.MobileElement字段

android - 突然执行 aapt 时出错

在 aapt PNG 文件处理期间,Android .apk 构建因 Gradle 失败

java - 如何在自动化 android webView 的情况下解决 "Cannot call non W3C standard command while in W3C mode"

java - 如何使用java检索模拟器中应用程序的应用程序ID?

ubuntu - Android Studio 1.0.2 在 Ubuntu 14.04 64 位操作系统上构建构建工具修订版 21.1.2 失败

android - Res' 在 Eclipse 中不存在

android - Android Gradle 插件中的 aaptOptions - noCompress

java - 使用 appium 运行测试脚本时出现 SecurtyException