0

I have been at this for 2 days now. I have added iOS as a platform with no issue. However adding Android as a platform is giving me this error:

"Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path."

I have added read tonnes of similar issues and added to my path like so:

export ANDROID_HOME=/Users/MYUSERNAME/SDKs/Android_SDK/
export PATH=/Users/MYUSERNAME/SDKs/Android_SDK/platform-tools:/Users/MYUSERNAME/Android_SDK/tools:$PATH

Yet it still throws up the same error. I used echo $PATH to make sure the path had updated and it's all as it should be according to other forums. Any ideas on why this isn't working for me? I'm losing my mind at this point!

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69
geolaw
  • 412
  • 1
  • 12
  • 26
  • Are you sure that `ant` is installed? It's not a default in 10.9.3 like it was in previous versions – Dawson Loudon Jun 24 '14 at 05:38
  • Check my answer here : http://stackoverflow.com/a/24281663/1785412 – Siddharth_Vyas Jun 24 '14 at 06:59
  • @DawsonLoudon if by installed you mean present within the "tools" folder of the SDK, then yes it is there. I haven't done anything with it though if that would have been the problem. – geolaw Jun 24 '14 at 12:55
  • @SiddharthVyas the issue is not with creating the project. That worked fine and I have also managed to add iOS as a platform without an issue. However when I use the CLI to add the platform "$cordova platform add android" it throws up the error originally specified in the question even though I have made appropriate changes to the .bash_profile also as specified within the initial question. Thank you for the responses so far. – geolaw Jun 24 '14 at 13:57
  • @DawsonLoudon I have done some research into ant and have installed. Still throws up the initial error – geolaw Jun 24 '14 at 14:43
  • Is there a `space` character in your user name? Also, did you close the terminal and restart it after updating `.bash_profile`? – Dawson Loudon Jun 24 '14 at 15:29
  • @DawsonLoudon No my username is one word and yes I restarted the terminal after making changes – geolaw Jun 24 '14 at 15:44
  • Sorry, can't really think of anything else... What happens if you try to run `android` on your own from the terminal? Maybe a permissions issue? `sudo cordova platform add android` – Dawson Loudon Jun 24 '14 at 16:45
  • did not work unfortunately, I will keep looking around for the answer thank you for trying to help though. I will update if the issue is resolved. Thanks again – geolaw Jun 24 '14 at 16:49

1 Answers1

0

Managed to figure it out. When specifying your path through "export PATH=" apparently it matter which one you check first. So what I had was

export PATH=/Users/MYUSERNAME/SDKs/Android_SDK/platform-tools:/Users/MYUSERNAME/Android_SDK/tools

what it should have been was

export PATH=/Users/MYUSERNAME/SDKs/Android_SDK/tools:/Users/MYUSERNAME/Android_SDK/platform-tools

platform is now added and seems to be working fine.

geolaw
  • 412
  • 1
  • 12
  • 26