1

I've installed nodejs and cordova and downloaded android sdk. The thing is when I try and add an android platform here's what sortf happen:

$ sudo cordova platform add android
Creating android project...
/home/blurt/.cordova/lib/npm_cache/cordova-android/3.6.4/package    /bin/node_modules/q/q.js:126
                throw e;
                      ^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

None of the solutions that I found in the Internet worked.

When I type :

$ echo $ANDROID_HOME

it gives nothing.

When I type:

 echo $PATH

it prints

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:  /usr/local/games:/opt/android-sdk/tools:/opt/android-sdk/platform- tools:/opt/node/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/node/bin

shows this.

I believe my SDK path is :/opt/android-sdk/tools

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
EnderCode
  • 235
  • 1
  • 3
  • 12

2 Answers2

2

You need to set the path to android sdk in ANDROID_HOME. The path needs to be till the root folder of the sdk or /opt/android-sdk/ in your case.

Add the following to your ~/.bashrc file.

# Android Path
PATH=$PATH:$HOME/Documents/Android/sdk:$HOME/Documents/Android/sdk/tools
export PATH

Then do a source ~/.bashrc to reload bashrc

Manish Kumar
  • 1,062
  • 8
  • 19
0

You haven't created the ANDROID_HOME environmental variable for your system. You should add it on the environmental variables by hand for example with method specified by mach on his answer.

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
  • thanks for fixing the question.. still not working, I've tried the answer thats posted in the link, but it didnt work. I guess Im using the wrong path – EnderCode Feb 08 '15 at 13:35