1

I have tried methods and commands given on other posts but none of them work.

Below is the way I followed but still got errors.

$ export ANDROID_HOME=/Android/Sdk
$ export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
$ sudo cordova build android
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.

Let me know how to proceed.

2 Answers 2

0

That is because you are trying to set the path wrong. the sdk files are in Home foler ~/Android/Sdk. here you are just using ANDROID_HOME=/Android/Sdk. it search for the root folder for Android/Sdk. use this below...

$ export ANDROID_HOME=~/Android/Sdk
$ export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
$ sudo cordova build android
-1

You are setting the environment variables in your environment. When you call sudo it uses the variables in the root environment because sudo essentially makes you root. Can you not use cordova without being root? If that's the case you'll need to set the variables in /etc/profile, log out, and log back in. Alternatively, check to see if cordova allows you to pass variables as a command line flag.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .