Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova android build fails immediately [Error: spawn EACCES]

Tags:

I am just getting started with with Cordova ( PhoneGap ) and trying to build my first project with it, however I am running into a problem with my compilation step- when I try to build ( in tracking down the problem I broke down the build step into prepare and compile and the former works fine as far as I know ) I see this:

~/Projects/MyProject$ cordova compile android
Compiling app on platform "android" via command "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build" 
{ [Error: spawn EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }

Now from what I can tell this is a permissions problem, but having no Node or Cordova experience yet I am at a loss as to how to troubleshoot it. It looks as though it is trying to spawn another process - maybe the Android SDK? - and it is failing.

Is there a way I can ask Node or Cordova to give me more information on what is going on or is there a log file somewhere that will help me to track down what the problem is?

Edit: I realised cordova has a --verbose switch and when I activated it I get the above output with an additional couple of lines...

Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Unfortunately, they don't seem to actually give much more information, like which process it can't start.

like image 521
glenatron Avatar asked Nov 21 '13 00:11

glenatron


2 Answers

For me, this has fixed it:

chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle

like image 75
Ricky Levi Avatar answered Oct 09 '22 06:10

Ricky Levi


It's a permission issue, just execute:

chmod 777 "/media/glenatron/localdisk/Projects/Cordova/MyProject/platforms/android/cordova/build"

That should fix the problem.

like image 38
Carlos Luis Rojas Aragonés Avatar answered Oct 09 '22 08:10

Carlos Luis Rojas Aragonés