Error creating platform with Cordova in Ubuntu (ANDROID_HOME is not set and "android")

0

First of all, I confess that I'm a Linux beginner and I currently use the updated Luna Elementary OS. So it's been really hard for me to sort this out.

I was able to install the entire NPM stack (Ionic, Cordova, Angular.js) and quiet Java. But at the time of installing the Android SDK tools (without IDE) in ubuntu I found it very complicated so I used this shell script to install everything automatically.

It worked, I installed the SDK, but at the time of creating the IONIC platform of this error:

    
asked by anonymous 07.02.2015 / 05:21

1 answer

3

You need to set the environment variable ANDROID_HOME to the path of the Android SDK install location.

Edit the file .profile in your home directory:

nano ~/.profile

Add the following lines:

export ANDROID_HOME=/caminho-do-sdk/android-sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools

To save the file in nano just press Ctrl + O and then Enter .

After that restart the terminal or type

source ~/.profile 

to load the variables you just left.

UPDATE:

If you have run the command as root (sudo, etc.), some directories in $HOME/.cordova and the directory of your project will be without written permission because they were created by root.

To solve, just a chown as root to recover the property:

$ sudo chown -R USUARIO:USUARIO /home/[USUARIO]/.cordova
$ sudo chown -R USUARIO:USUARIO /caminho/do/projeto/
    
07.02.2015 / 05:43