Apache Cordova:生成失败错误代码1和Javascript异常

Apache Cordova: Build failed Error code 1 and Javascript Exception

本文关键字:Javascript 异常 错误代码 失败 Cordova Apache      更新时间:2023-09-26

我正在用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,只有一个错误><

对我来说,解决方案是:

cordova clean

然后当我运行时:

cordova emulate android

一切都恢复了!