0

I'm trying to generate an APK file for my android release. When I type in

ionic cordova build --release android

It gives me this error

ANDROID_HOME=/Users/user/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Error: spawn EACCES

What does EACCES mean and how to fix it?

Logs

ionic cordova build --release android --verbose
[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/Haddy/Desktop/ionic/ionicapp/ionicapp', local: false, binPath: 
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: 
        '/usr/local/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 676)
Running app-scripts build: --platform android --target cordova
[13:07:42]  build dev started ... 
[13:07:43]  clean started ... 
[13:07:43]  clean finished in 15 ms 
[13:07:43]  copy started ... 
[13:07:43]  deeplinks started ... 
[13:07:43]  deeplinks finished in 320 ms 
[13:07:43]  transpile started ... 
[13:07:49]  transpile finished in 5.96 s 
[13:07:49]  preprocess started ... 
[13:07:49]  preprocess finished in 2 ms 
[13:07:49]  webpack started ... 
[13:07:54]  copy finished in 10.98 s 
[13:08:01]  webpack finished in 11.93 s 
[13:08:01]  sass started ... 
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[13:08:03]  sass finished in 1.60 s 
[13:08:03]  postprocess started ... 
[13:08:03]  postprocess finished in 19 ms 
[13:08:03]  lint started ... 
[13:08:03]  build dev finished in 20.16 s 
> cordova build android --release

ANDROID_HOME=/Users/user/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Error: spawn EACCES

EDIT: Updated my Question, It has not been answered

cdh429
  • 337
  • 3
  • 11
  • 20
  • 1
    Possible duplicate of [How to set or change the default Java (JDK) version on OS X?](https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-os-x) – Suraj Rao Mar 05 '18 at 17:06
  • Updated my question – cdh429 Mar 05 '18 at 17:44
  • Could you please run `ionic cordova build --release android --verbose`? And paste the error message in here? Looks like something with your permissions is wrong. – QuickSort Mar 05 '18 at 18:04
  • Sure thing @QuickSort - just edited the file – cdh429 Mar 05 '18 at 18:11
  • Have you tried making the gradle executable? Like: `sudo chmod 755 /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle` when using a mac. – QuickSort Mar 05 '18 at 18:18
  • That didn't work...However this did! Thank you for getting me on thie right track! sudo chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle – cdh429 Mar 05 '18 at 18:52

0 Answers0