离子失败 构建 apk 并将其部署到物理设备



我正在尝试构建一个应用程序,我已经使用ionic 2在其他设备和计算机上进行了测试。我一直收到此错误,然后是构建完成并部署了应用程序,即使它不是。

    (node:11125) UnhandledPromiseRejectionWarning: Error: /Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> java.io.IOException: Could not delete path '/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/app/build/intermediates/assets/debug/www/index.html'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
    at ChildProcess.whenDone (/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:11125) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11125) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?
MacOSs-MacBook-Pro:frontendrest kieran$

有时我也有类似的问题。

  1. 只需删除路径中的中间体文件夹:

/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/app/build/intermediates

  1. 在任务管理器中终止"java"进程。