Trouble with Android sdk Home variable


#1

up vote
0
down vote
favorite
I use this script to install ionic cordova and android skd in Ubuntu 14

But every time I use the command ionic, It says:"/bin/sh: 1 Cordova permision denied"

So I have to use sudo to execute. The problem is that when building the app
sudo ionic build android
It returns:

ERROR building one of the platforms: Failed to find ‘ANDROID_HOME’ environment variable. Try setting setting it manually.
Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to include path to valid SDK directory.
You may not have the required environment or OS to build this project
Error: Failed to find ‘ANDROID_HOME’ environment variable. Try setting setting it manually.
Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to include path to valid SDK directory.

So I checked the env variable with:
echo $ANDROID_HOME

And returns: /opt/android-sdk

I tried giving permission to cordova with:
sudo chown -R $(whoami) $HOME/.cordova

I also tried giving full permission to directories:
sudo chmod -R 777 /opt/android-sdk
sudo chmod -R 777 /opt/node/
sudo chmod -R 777 $HOME/.cordova

Still no luck :sob: