Cordova android build fails immediately [Error: spawn EACCES]

原创 2017年10月13日 09:16:51

在学习Cordova时,build android平台时,遇到spawn EACCES错误,在网上找了几篇帖子,都说是权限问题,按照描述更改了各种提到的文件权限,始终没有解决。最后在stackoverflow找到了最好的解决方法。
本人用的时OS X系统,其他系统应该相同。另外本人机器上同时安装了android studio 3.0 preview和2.3两个版本,所以有两个gradle的版本,系统默认会调用最新版/最后安装的版本,所以使用以下命令可以找出具体出问题的:

cordova build –release –verbose android

输出如下:

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/xxxx/Dev/workspace/cordova_ws/hello/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 "HelloWorld" to /Users/xxxx/Dev/workspace/cordova_ws/hello/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.example.hello" to /Users/xxxx/Dev/workspace/cordova_ws/hello/platforms/android/src/com/example/hello/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=/Users/xxxx/Library/Android/sdk
JAVA_HOME=/Users/xxxx/Dev/JDK
Running command: "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1/bin/gradle" -p /Users/xxxx/Dev/workspace/cordova_ws/hello/platforms/android wrapper -b /Users/xxxx/Dev/workspace/cordova_ws/hello/platforms/android/wrapper.gradle
Error: spawn EACCES

然后在输出信息中(往往是最后几行)找到最后执行的文件,此处为

Running command: "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1/bin/gradle" -p /Users/xxxx/Dev/workspace/cordova_ws/hello/platforms/android wrapper -b 

修改此gradle执行文件的权限

 chmod 777 <file> 

再执行

cordova build android

[Ionic]cordova build android报错

[Ionic]cordova build android报错@Author GQ 2017年03月30日 最近刚开始接触webapp使用的是ionic框架,结果一地的坑啊!安装工具 通过npm安装i...

nodejs异常之-Error: listen EACCES 127.0.0.1:8000

异常信息Error: listen EACCES 127.0.0.1:8000 at Object.exports._errnoException (util.js:1018:11) ...

maven javadoc plugin build fails with Java 8 when Javadoc tags are incomplete

本地开发环境JDK版本是1.7,生成Javadoc没有问题,在测试环境使用Jenkins自动构建时报错(测试服务器JDK版本是1.8),log如下:/home/andreas/workspaces/c...
  • FX_SKY
  • FX_SKY
  • 2017年01月20日 18:09
  • 1227

EM 12c Cloud Control Re-Installation Fails at Repository Configuration With Error " RCU-6016:The spe

Applies to: Enterprise Manager Base Platform - Version: 12.1.0.1.0 and later   [Release: 12.1 and ...
  • hijk139
  • hijk139
  • 2012年01月20日 16:04
  • 2202

Android Gradle Build Error:Some file crunching failed, see logs for details解决办法

错误日志:Error:java.lang.RuntimeException: Some file crunching failed, see logs for details     ...

Android build error on Ubuntu 16.04 LTS

http://oopsmonk.github.io/blog/2016/06/07/android-build-error-on-ubuntu-16-04-lts After...
  • ee230
  • ee230
  • 2017年06月23日 11:30
  • 288

EMCA fails with error "ORA-01017: invalid username/password; logon denied"

Creation of dbcontrol repository fails when execute $ emca -config dbcontrol -repos createWith error...

eclipse运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar Unknown error: Un

前几天在ecplise上运行项目还好好,今天一运行就提示这个错误:Your project contains error(s), please fix them before running your...

android项目编译报错:error occurred during the build

在使用svn从服务器down项目到eclipse的时候,一打开eclipse就报错,提示building workspace error,然后在网上查找了各种方法:汇总一下:1, S...

android Error:Abnormal build process termination:

前提,电脑重装了系统,装了新的jdk和intellij idea 来开发android项目。问题:导入原有的项目后,报了个前所未遇的错误Error:Abnormal build process ter...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Cordova android build fails immediately [Error: spawn EACCES]
举报原因:
原因补充:

(最多只允许输入30个字)