2

I'm tring to install cordova on linux. When I want build android platform taking ANDROID_HOME is not set and "android" command not in your PATH.

What I did;

1. installed lubuntu
2. sudo apt-get update
3. sudo apt-get upgrade
4. sudo apt-get install git
5. sudo apt-get install nodejs
6. sudo apt-get install npm
7. sudo ln -s /usr/bin/nodejs /usr/bin/node
8. sudo apt-get install ant
9. sudo apt-get install openjdk-7-jre
10. sudo apt-get install openjdk-7-jdk
11. sudo apt-get install lib32stdc++6
12. downloaded android sdk and unzipped /home/sakarya/android-sdk-linux
13. opened sdk manager and installed api 8, 10, 19, 22 and 22 MNC with all extras
14. sudo nano ~/.bashrc or sudo nano /root/bashrc or sudo nano ~/.profile
export ANDROID_HOME="~/android-sdk-linux"
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
--or--
export ANDROID_HOME = "~/android-sdk-linux"
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
15. sudo npm install -g cordova
16. dir: /home/sakarya
sudo cordova create hello - no error
cd hello
sudo cordova plugin add cordova-plugin-network-information - no error
sudo cordova platform add android - no error
sudo cordova build android - error
17. android command works. it opens sdk manager.

What the reason can be?

Thanks.

sakarya
  • 123
  • 1
  • 1
  • 3

2 Answers2

1

The key is in /etc/profile and to remove double quotation

try putting your environment variable in /etc/profile then make a reboot for your computer

export PATH=${PATH}:~/android-sdk-linux

without double quotations

kamil
  • 7,275
  • 6
  • 40
  • 60
1

You can also add environment variable in ~/.profile . 'ANDROID_HOME' environment variable should be set.

export ANDROID_HOME=~/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

And simply reboot your machine.

More info can be found here.

userAbhi
  • 163
  • 6