Apache Cordova:构建失败错误代码1和Javascript异常

时间:2015-11-09 20:47:01

标签: javascript android apache cordova

我正在使用Apache Cordova制作一个小型Android应用程序。一切都很好,直到构建开始崩溃。正如这里建议的另一个线程,我重新安装了我正在使用的Apache Cordova插件(媒体)。在MSDN,有人通过删除C:/Users/MyName/.gradle找到帮助并关闭防火墙,因此java将再次下载一些内容。我下载后失败了:

......
    :compileDebugRenderscript UP-TO-DATE
1>  :generateDebugBuildConfig UP-TO-DATE
1>  :generateDebugAssets UP-TO-DATE
1>  :mergeDebugAssets FAILED
1>
1>  FAILURE: Build failed with an exception.
1>
1>  * What went wrong:
1>  Execution failed for task ':mergeDebugAssets'.
1>  > java.lang.NullPointerException (no error message)
1>
1>  * Try:
1>  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>
1>  BUILD FAILED
1>
1>  Total time: 3 mins 11.981 secs
1>  Picked up _JAVA_OPTIONS: -Xmx512M
1>
1>  C:\Users\Paul\Documents\Visual Studio 2015\Projects\LifePointCounter\LifePointCounter\platforms\android\cordova\node_modules\q\q.js:126
1>                      throw e;
1>                            ^
1>  Error code 1 for command: cmd with args: /s /c ""C:\Users\Paul\Documents\Visual Studio 2015\Projects\LifePointCounter\LifePointCounter\platforms\android\gradlew" cdvBuildDebug -b "C:\Users\Paul\Documents\Visual Studio 2015\Projects\LifePointCounter\LifePointCounter\platforms\android\build.gradle" -Dorg.gradle.daemon=true"
1>  Command finished with error code 1: cmd /s /c ""C:\Users\Paul\documents\visual studio 2015\Projects\LifePointCounter\LifePointCounter\platforms\android\cordova\build.bat" --debug "--buildConfig=C:\Users\Paul\documents\visual studio 2015\Projects\LifePointCounter\LifePointCounter\build.json""
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 1
1>  You may not have the required environment or OS to build this project
1>MDAVSCLI : error : cmd: Command failed with exit code 1

在出现此错误之前我做的最后一件事是:

  • 更改一些资源音频文件(之后播放它们会在运行时出错)
  • 在我的设备上卸载我的应用程序(通过构建重新安装)

我不知道那里发生了什么,我对此并不熟悉。

编辑:

另一个线程建议Node.js为版本0.10.36 现在我得到退出代码8,只有一个错误>。<

1 个答案:

答案 0 :(得分:3)

对我来说,解决方案是:

cordova clean

然后当我跑:

cordova emulate android

一切都恢复了!