在Mac中使用calabash-android构建[错误]无法找到Android SDK,请确保已安装

时间:2016-08-09 09:00:15

标签: xamarin calabash calabash-android xamarin-test-cloud

我正在尝试在我的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 for SDK,它完全正常,如下所示

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

1 个答案:

答案 0 :(得分:0)

根据Calabash installation docs的建议你不应该在安装或使用宝石时使用sudo:

  

你永远不应该用sudo安装宝石。如果您遇到问题   安装捆绑器,我们建议使用Calabash Sandbox或使用   Ruby的托管版本,例如rbenv或rvm。

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

例如,这些是地雷(我在〜/ Documents中解压缩了文件夹):

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

它就像一个魅力