LoginSignup
30
14

More than 5 years have passed since last update.

cordova buildでError: spawn EACCESが発生した時の対処方法

Posted at

cordova buildでError: spawn EACCESと怒られた

$ cordova build android
ANDROID_HOME=/Users/bin/android-sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
Error: spawn EACCES

よくわからない。ググってもionicのことしか出てこないし書いてあるようにフォルダの権限を変えても直らないし。しばらくはまったけど、以下で直った。

対処方法

chmod +x "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.0-milestone-1/bin/gradle”

どうやらAndroid Studioをアップデートしてgradeの実行権限が変わったためみたいだった。
ヒントは以下。gradeの実行の直後でエラーになってる。

$ cordova build android --verbose
No scripts found for hook "before_build".
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/src/Cordova/test/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 "Test" to /Users/src/Cordova/test/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.bathtimefish.test" to /Users/src/Cordova/test/platforms/android/src/com/bathtimefish/test/MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=/bin/android-sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
Running command: "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.0-milestone-1/bin/gradle" -p /Users/src/Cordova/test/platforms/android wrapper -b /Users/src/Cordova/test/platforms/android/wrapper.gradle
Error: spawn EACCES

あと、このコメントが決め手になった。
https://forum.ionicframework.com/t/ionic-build-android-error-spawn-eacces/88358/5

30
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
14