2
votes

I'm using Ubuntu 14.04. I'm following the steps given in http://chrislarson.me/blog/how-use-cordova-ubuntu-build-android-apps.html to build my first app for Android on Ubuntu.

But when I run this: cordova platform add android, I get the following message on the terminal:

Error: EACCES, open '/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/.npmignore'

If i try running sudo cordova platform add android, I get

Creating android project...

/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:126 throw e; ^ Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions. at /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:159:19 at _fulfilled (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54) at self.promiseDispatch.done (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30) at Promise.promise.promiseDispatch (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13) at /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:821:14 at flush (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:108:17) at process._tickCallback (node.js:442:13) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:929:3 Error: /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 8 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:766:16) at Process.ChildProcess._handle.onexit (child_process.js:833:5)

2
Is your path is correct? and Please can you confirm it by typing android in terminal and see whether your getting SDK manager?Muthu
I type in android and it says command not founduser4491289
see that’s your problem. I think /home/a/Developm‌​ent/adt-bundle-linux-x86-20140702/sdk is not your sdk path. can you verify it?Muthu
I think my problem is understanding environment variables in Linux. Based on the output of my echo $PATH , please could you advice how to set up the path?user4491289
remove old paths and add these to your bashrc export ANDROID_HOME=your sdk path export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools and after that use source ~/.bashrc to execute bashrc fileMuthu

2 Answers

0
votes

try deleting the contents of

.cordova/lib/npm_cache/cordova-android/

and then try again.

cordova / npm cache cordova-android files deleting these will ensure a clean install.

0
votes

first check your android path by echo $ANDROID_HOME then if it is showing path then you have set ANDROID_HOME path correctly and if not then do this 1) sudo gedit ~/.bashrc 2) then paste following path at the last of file save it and close.

export ANDROID_HOME=your_sdk_path/sdk export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

your first error is permission issue and second because ANDROID_HOME path not set correctly