0

I am using Ubuntu 14.04 64 bits. I have installed phonegap and cordova. Also downloaded android API 19 using sdk manager.

In terminal,on typing

echo $ANDROID_HOME

I get

/home/hehe/android-sdk-linux

on typing android in terminal,sdk manager opens

on running following command,

sudo cordova run android

I get following error

Running command: /home/hehe/app/vbet/platforms/android/cordova/run 
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /home/hehe/app/vbet/platforms/android/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)

I was having cordova 4.3 installed and then following this answer, I removed 4.3 and installed cordova 3.5 but still getting same error

Community
  • 1
  • 1
programmer
  • 324
  • 8
  • 22

1 Answers1

0

The env profile for sudo will not be the same as your user env profile. This means that $ANDROID_HOME does not exist in your path for sudo even though it might for your user.

You may want try just doing cordova run android instead.

If that fails, it means parts of your Android or Cordova installation have incorrect permissions that should be corrected. In this case, 777 or 775 will probably be fine.

If you wanted to start from scratch, I also wrote a script that will do all this for you, but you'll need to have a fresh start.

https://blog.nraboy.com/2014/09/install-android-cordova-ionic-framework-ubuntu/

Regards,

Nic Raboy
  • 3,143
  • 24
  • 26