Error on build android

Hi all,
today I had this problem, when I try to build my android app the CLI said:

Running command: /home/francesco/mce/platforms/android/cordova/build
execvp(): Permission denied
ERROR building one of the platforms: Error: /home/francesco/mce/platforms/android/cordova/build: Command failed with exit code EACCES
You may not have the required environment or OS to build this project
Error: /home/francesco/mce/platforms/android/cordova/build: Command failed with exit code EACCES
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:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)

Why? How can I fix this problem?

The way I “fixed” a similar problem.

sudo ionic build android (or ios)

I just tried it but doesn’t work…
I have the same problem

What did you find on google so far?

I’ve googled your error and found this quesiton on stackoverflow:

For some reason build is not currently an executable file. To fix that, open the terminal and enter the following commands:

$ cd <your-project-directory>/platforms/android/cordova
$ chmod a+x build


This is a common PhoneGap problem.

Most of the time it's got to do with permissions on the build folder and script file.

Try using: chmod a+x on them.

have you tried these solutions?

Yes… I tried

francesco@francesco-K53BY ~ $ cd /home/francesco/mce/platforms/android/ant-buildfrancesco@francesco-K53BY ~/mce/platforms/android/ant-build $ chmod a+x build
chmod: impossibile accedere a “build”: File o directory non esistente
francesco@francesco-K53BY ~/mce/platforms/android/ant-build $

Translate in english: chmod: impossible access to “build”. File or directory doesn’t exists

and now if I try to doing

cd myapp

ionic build android

the cli says:

The provided path "/home/francesco/mce/platforms/android" is not an Android project.

I create a new project with ionic, paste the folders: img, js, css, templates in the new project and it run now…
I don’t know what was the problem but now it isn’t a problem :wink:

another thing to try when you have problems in build is to remove and re-add the new platforms. I often have to do this whenever a new version of ionic comes out. Although this sounds like it is more to do with the permissions on that folder.