Reputation:
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)
Upvotes: 2
Views: 1240
Reputation: 372
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
Upvotes: 0
Reputation: 599
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.
Upvotes: 0