calabash-android build in Mac 给出 [Error]Could not find an Android SDK 请确保它已安装

calabash-android build in Mac giving [Error]Could not find an Android SDK please make sure it is installed

我正在尝试在我的 mac 中构建 calabash-android 我收到以下错误

sudo calabash-android build /Users/igate/Downloads/SimpleCreditCardValidator/app/app-release.apk
ERROR: Could not find an Android SDK please make sure it is installed.
ERROR: You can read about how Calabash is searching for an Android SDK and how you can help here:
ERROR: https://github.com/calabash/calabash-android/blob/master/documentation/installation.md#prerequisites
/Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/dependencies.rb:114:in `setup': Could not find an Android SDK (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/dependencies.rb:41:in `java_dependencies'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/dependencies.rb:81:in `keytool_path'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/helpers.rb:186:in `block (2 levels) in fingerprint_from_apk'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/helpers.rb:169:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/helpers.rb:169:in `block in fingerprint_from_apk'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:88:in `mktmpdir'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/lib/calabash-android/helpers.rb:168:in `fingerprint_from_apk'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/bin/calabash-android-build.rb:2:in `calabash_build'
    from /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.8.0/bin/calabash-android:71:in `<top (required)>'
    from /usr/bin/calabash-android:23:in `load'
    from /usr/bin/calabash-android:23:in `<main>'

我也检查了我的 bash_profile SDK 它完全没问题,如下所示

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

正如 Calabash installation docs 上的建议,您在安装或使用 gems 时都不应该使用 sudo:

You should never install gems with sudo. If you are having issues installing bundler, we recommend using the Calabash Sandbox or using a managed version of Ruby, e.g. rbenv or rvm.

此外,回到 Android SDK,确保您从 here 下载正确的 SDK,将文件解压缩到您想要的任何位置,然后插入到您的 .bash_profile 正确的路径。

例如,这些是我的(我已将文件夹解压到 ~/Documents 中):

export ANDROID_HOME="$HOME/Documents/android-sdk-macosx"
export ANDROID_SDK_ROOT="$ANDROID_HOME"

它就像一个魅力