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

Asked

Viewed 1,888 times

0

First of all, I confess that I am a beginner in Linux and currently use the updated Elementary OS Luna. So it’s been really hard for me to figure it out.

I was able to install all the NPM stack (Ionic, Ordova, angular.js) and the quiet Java. Only at the time of installing Android SDK tools (no IDE) in Ubuntu I found it very complicated so I used that shell script to install everything automatically.

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

inserir a descrição da imagem aqui

1 answer

4


You need to set the environment variable ANDROID_HOME with the path of Android SDK installation 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 to nano just squeeze CTRL+O and then Enter.

After that restart the terminal or type

source ~/.profile 

to load the variables you just set.

UPDATE:

If you have executed 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 one chown as root to recover property:

$ sudo chown -R USUARIO:USUARIO /home/[USUARIO]/.cordova
$ sudo chown -R USUARIO:USUARIO /caminho/do/projeto/
  • Man, I don’t know which way to-do-sdk

  • 1

    @ropbla9 You downloaded the SDK from Android?

  • yes. and installed by the script I told you. But I don’t know where it is. Can’t you see in the image I showed you? There’s the folder . android (hidden) in the home, that’s it

  • Ah, you have a folder called /opt/android-sdk.

  • 1

    @ropbla9 Probably is the /opt/android-sdk same. The .android stores settings and other things sdk uses.

  • 'cause it’s man. I did like you said and it didn’t work.

  • Before adding what you put was configured like this > export PATH=$PATH:/opt/android-sdk/tools
export PATH=$PATH:/opt/android-sdk/platform-tools
export PATH=$PATH:/opt/node/bin
export JAVA_HOME=/usr/lib/jvm/default-java Then in the last few lines I added yours.

  • 1

    You’re running this with sudo? If you are editing the root . profile with sudo nano /root/profile.

  • This file is empty. And edit with what?

  • 1

    Add those same two lines I mentioned in the reply.

  • nothing expensive. I tried to source this root but n.

  • 1
  • the problem has been solved?

Show 8 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.