Cordova reports that ANDROID_HOME is not set even though it is

I am trying to create a hello world app that ships with Cordova. I created a project and added to my .bashrc:

export ANDROID_HOME=~/Android/Sdk
export PATH=${PATH}:~/Android/Sdk/tools:~/Android/Sdk/platform-tools

      

When I run echo $ ANDROID_HOME I see the correct path and run echo $ PATH also returns the path with the correct sdk app. However, when I run sudo cordova build it still says $ ANDROID_HOME is not installed, android is not in your path. I've tried to fix this in the last 3 hours with no solution :( Any help is appreciated! Thanks!

+3


source to share


1 answer


I seem to have fixed my problem.

I am not 100% what it was, but it is likely that it has something to do with the combination sudo

and my variable JAVA_HOME

not being set.



I previously ran sudo cordova build

that returned an error. I tried to delete and recreate the project after I read somewhere that it might be due to sudo. After reconstitution, the project I ran it only with the help cordova build

, and I got a new error: Unable to run java -version

. I realized that I was having trouble getting my jdk installation installed and I read somewhere that you need to assign the JAVA_HOME variable in your .bashrc. So I added in export JAVA_HOME=/opt/java/jdk1.8.0_45

and then added $JAVA_HOME/bin

to my path. After that, it worked successfully.

0


source







All Articles