Ionic v3.7.0 Error: spawn EACCES on android build


#1

Error on run cordova run android --verbose , and that show me

No scripts found for hook “before_run”.
No scripts found for hook “before_prepare”.
Checking config.xml and package.json for saved platforms that haven’t been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven’t been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing…
Generating platform-specific config.xml from defaults for android at /Users/User/Desktop/Apps/App/platforms/android/res/xml/config.xml
Merging project’s config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name “MyApp” to /Users/User/Desktop/Apps/App/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name “com.test.test” to /Users/User/Desktop/Apps/App/platforms/android/src/com/test/test/MainActivity.java
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook “after_prepare”.
ANDROID_HOME=/Users/User/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Running command: “/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1-rc-1/bin/gradle” -p /Users/User/Desktop/Apps/App/platforms/android wrapper -b /Users/User/Desktop/Apps/App/platforms/android/wrapper.gradle
Error: spawn EACCES


#2

Run ionic cordova run android --verbose please.
Run cordova requirements please.
Also post your ionic info output please.


#3

on ionic cordova run android --verbose

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: ‘/Users/User/Desktop/Apps/App’, local: true, binPath:
’/Users/User/npm-global/lib/node_modules/ionic/bin/ionic’, libPath:
’/Users/User/Desktop/Apps/App/node_modules/ionic/dist/index.js’ }
[DEBUG] Loading local plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for local @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
[DEBUG] Daemon found (pid: 5236)
[DEBUG] Getting plugin info for ionic
[DEBUG] Checking for latest plugin version of ionic@latest.
[DEBUG] Getting plugin info for @ionic/cli-plugin-cordova
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-cordova@latest.
[DEBUG] Getting plugin info for @ionic/cli-plugin-ionic-angular
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-ionic-angular@latest.
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --nobrowser

[17:33:44] build dev started …
[17:33:44] clean started …
[17:33:44] clean finished in 2 ms
[17:33:44] copy started …
[17:33:44] transpile started …
[17:33:46] transpile finished in 1.95 s
[17:33:46] preprocess started …
[17:33:46] deeplinks started …
[17:33:46] deeplinks finished in 60 ms
[17:33:46] preprocess finished in 60 ms
[17:33:46] webpack started …
[17:33:46] copy finished in 2.14 s
[17:33:53] webpack finished in 7.38 s
[17:33:53] sass started …
[17:33:55] sass finished in 1.74 s
[17:33:55] postprocess started …
[17:33:55] postprocess finished in 4 ms
[17:33:55] lint started …
[17:33:55] build dev finished in 11.18 s

ionic cordova prepare
cordova prepare
:heavy_check_mark: Running command - done!

cordova run android
[17:33:57] lint finished in 1.89 s
ANDROID_HOME=/Users/User/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Error: spawn EACCES

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova run android (exit code 1).

on cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed Google Inc.:Google APIs:21,android-26,android-25,android-24,android-23,android-22,android-21
Gradle: installed /Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1-rc-1/bin/gradle

Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.3
ios-deploy: installed 1.9.0
CocoaPods: not installed
CocoaPods was not found. Please install version 1.0.1 or greater from https://cocoapods.org/
Error: Some of requirements check failed

on ionic info

cli packages: (/Users/User/Desktop/Apps/App/node_modules)

@ionic/cli-plugin-cordova       : 1.6.2
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils                : 1.7.0
ionic (Ionic CLI)               : 3.7.0

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Android SDK Tools : 25.2.5
Node              : v6.9.2
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b
ios-deploy        : 1.9.0
ios-sim           : 5.0.8
npm               : 4.2.0

#4

My guess - but this is really just a guess - would be that cordova-android doesn’t like that version or it is installed in a way so that it can’t access it.


#5

how did you resolve this?


#6

Remove your Android SDK and reinstalled


#7

This solution worked for me:

sudo chmod -R 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle

I just modified this stack overflow answer to fit my Android Studio installation path.


#8

This worked for me, legend!


#9

thanks mate… you saved my day…!!


#10

Thanks worked for my gradle-4.4


#11

ionic cordova platform rm android
ionic cordova platform add android

this worked for me