I’m getting a “Could not find an Android SDK please make sure it is installed” error when trying to run calabash-android commands. I’ve installed the Android SDK via brew. Here are the contents of my .bash_profile:
ANDROID_HOME=/usr/local/Cellar/android-sdk/24.2 PATH=$PATH:$ANDROID_HOME/tools PATH=$PATH:$ANDROID_HOME/platform-tools PATH=$PATH:$ANDROID_HOME/build-tools if [ -f ~/.bashrc ]; then source ~/.bashrc fi [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* PATH=$PATH:/usr/local/apache-ant-1.9.4/bin PATH=$PATH:/usr/local/share/npm/bin JAVA_HOME=/usr/libexec/java_home export PATH
Here’s my $PATH:
echo $PATH /Users/mchumak/.rvm/gems/ruby-2.1.1/bin:/Users/mchumak/.rvm/gems/[email protected]/bin:/Users/mchumak/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/android-sdk/24.2/tools:/usr/local/Cellar/android-sdk/24.2/platform-tools:/usr/local/Cellar/android-sdk/24.2/build-tools:/Users/mchumak/.rvm/bin:/Users/mchumak/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Users/mchumak/.rvm/bin:/usr/local/apache-ant-1.9.4/bin:/usr/local/share/npm/bin
“which android” produces:
The contents of that particular file are:
#!/bin/bash TOOL="/usr/local/Cellar/android-sdk/24.2/tools/android" exec "$TOOL" "[email protected]"
I can run the Android SDK Manager from the command line just fine, and it shows the correct SDK path (/usr/local/Cellar/android-sdk/24.2).
I’m stumped. Any ideas why calabash-android can’t find the SDK?
This will fix your issue,
echo "export PATH=$PATH:/Users/#username/Library/Android/sdk/platform-tools/sdk/platform-tools/" >> ~/.bash_profile
install android-platform-tools ->
brew install android-platform-tools
– Also ensure yourself have admin rights
Looking at your $PATH output seems like android sdk path isnt loaded into PATH. Add below to your .bash_profile
calabash-android run /Users/marcg/Downloads/app-news.apk
I received that following error
Could not find any platform directory in ‘/Users/marcg/Library/Android/sdk/platforms’
I corrected this with the symlink below:
/Users/marcg/Library/Android/sdk/platforms platforms$ ln -s ../platform-tools/ platform
I ran again and get an error that the android jar was missing from a standard directory of
I then copied that android.jar to this platforms dir
Dir now looks like:
/Users/marcg/Library/Android/sdk/platforms us164912:platforms marcg$ ls -l total 49640 -rwxr-xr-x 1 marcg Users 25409822 Oct 5 09:26 android.jar lrwxr-xr-x 1 marcg Users 18 Oct 5 09:14 platform -> ../platform-tools/
Did not find ‘android.jar’ in any standard directory of ‘/Users/marcg/Library/Android/sdk/platforms’. Calabash will therefore take longer to load
I copied the
android.jar to the
platform-tools directory and remaining error went away.
Steps to correct:
- Make a symlink in platforms that points to platform-tools
ln -s ../platform-tools/ platform
- Copy the android.jar to the platform-tools dir
Would be better if the framework allowed you configure via file or additional env vars where to find each of these. My earlier attempt to set
ANDROID_HOME to the platform-tools dir didn’t work and why I did a symlink.