How to Solve ‘ionic cordova build android’ Issue on Mac OS X

in #ionic7 years ago

Lately I was working on an Ionic 2 app when I tried the ionic cordova build android and it outputs an error as below:

ANDROID_HOME=~/android-sdk-macosx/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
Error: spawn EACCES

The solution is:

Use the command line to chmod gradle inside your Android Studio as below (you may have different versions of Android Studio and different gradle versions):

chmod +x /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/gradle/gradle-4.1-milestone-1/bin/gradle

Then execute the ionic cordova build android again.