UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES Ionic 3

Run the following command:

cordova build android --verbose

You can get output something like this:

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

Error: spawn EACCES
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    .....
    .....

Note the line:

Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle"

This shows that there is permission issue with the file /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle.

To fix the issue, give appropriate permission to that file so that it can be executable.

You can run the following command:

sudo chmod +x /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle

This should solve the issue.