I was was working with an cordova/ionic project for past couple of weeks. I used windows for development. But recently I had to change my developing environment to Ubuntu. I use Ubuntu 15.10. Tried to build the same project in Ubuntu after setting up Android SDK , JDK ANT ect., gave me this error. I can "ionic serve" or "cordova serve" without any problem. Tried removing and re adding the platform android but the issue was same. Below is the error.
user@myhost:~/works/myproject$ ionic build android
Running command: /home/user/works/myproject/hooks/after_prepare/010_add_platform_class.js /home/user/works/myproject
add to body class: platform-android
Running command: /home/user/works/myproject/hooks/after_prepare/020_remove_sass_from_platforms.js /home/user/works/myproject
Running command: /home/user/works/myproject/platforms/android/cordova/build
ANDROID_HOME=/home/user/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Running: /home/user/works/myproject/platforms/android/gradlew cdvBuildDebug -b /home/user/works/myproject/platforms/android/build.gradle -Dorg.gradle.daemon=true
error caught: Error: spawn EACCES
/home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error: spawn EACCES
at exports._errnoException (util.js:874:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at Object.exports.spawn (child_process.js:339:9)
at module.exports (/home/user/works/myproject/platforms/android/cordova/lib/spawn.js:37:35)
at /home/user/works/myproject/platforms/android/cordova/lib/build.js:370:24
at _fulfilled (/home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:760:13)
at /home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:821:14
at flush (/home/user/works/myproject/platforms/android/cordova/node_modules/q/q.js:108:17)
ERROR building one of the platforms: Error: /home/user/works/myproject/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /home/user/works/myproject/platforms/android/cordova/build: Command failed with exit code 1
Checked for permission/ownership issues but didn't find any. I can compile a java file therefore not a problem with my jdk. Here is my ionic info
Cordova CLI: 5.4.0
Ionic CLI Version: 1.7.8
Ionic App Lib Version: 0.6.4
OS: Distributor ID: Ubuntu Description: Ubuntu 15.10
Node Version: v4.2.2
Having a chmod 765 recursively on my android-sdk folder fixed it
Thanks to Muhsin for Help :D
chmod 777 -R ~/android
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With