Ionic build android, Error: spawn EACCES

Got the same error today. Thanks to the comments above, here is how I fixed it.

Ran:

cordova build android --verbose

and it showed me where it got the “Permission Denied” error… In my case it was:

Running command: /usr/libexec/java_home
Command finished with error code 0: /usr/libexec/java_home
ANDROID_HOME=/Users/mj/phonegap/adt-bundle-mac-x86_64-20140321/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle"
 -p /Users/mj/EduceMobile/app/platforms/android wrapper -b /Users/mj/EduceMobile/app/platfo
rms/android/wrapper.gradle

To fix, ran:

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

…and

...
...
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 2 mins 44.195 secs

Hope it helps.

Leave a Comment