离子生成cordova android给出错误“UnhandledPromiseRejectionWarning:错误:cmd:命令失败,退出代码为1”

时间:2018-04-26 18:34:04

标签: android cordova ionic-framework build.gradle phonegap

我正在尝试构建和离子项目作为apk。当我ionic cordova build android时,它会出现以下错误

Running app-scripts build: --platform android --target cordova
[23:35:31]  build dev started ...
[23:35:31]  clean started ...
[23:35:31]  clean finished in 20 ms
[23:35:31]  copy started ...
[23:35:31]  deeplinks started ...
[23:35:31]  deeplinks finished in 75 ms
[23:35:31]  transpile started ...
[23:35:35]  transpile finished in 3.87 s
[23:35:35]  preprocess started ...
[23:35:35]  preprocess finished in 33 ms
[23:35:35]  webpack started ...
[23:35:35]  copy finished in 4.25 s
[23:35:40]  webpack finished in 4.78 s
[23:35:40]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[23:35:41]  sass finished in 1.02 s
[23:35:41]  postprocess started ...
[23:35:41]  postprocess finished in 77 ms
[23:35:41]  lint started ...
[23:35:41]  build dev finished in 10.20 s
> cordova build android --debug

You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected

ANDROID_HOME=C:\Users\makarov\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
studio
Subproject Path: CordovaLib
Subproject Path: app
[23:35:44]  lint finished in 3.65 s
publishNonDefault is deprecated and has no effect anymore. All variants are now published.


FAILURE: Build failed with an exception.

* Where:
Build file 'C:\My_Files\Projects\MyNoteApp\platforms\android\CordovaLib\build.gradle' line: 84

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> build_ihrdqe7fln9qjqpg3xt8ghgr$_run_closure3$_closure11$_closure12$_closure13$_closure14

* 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 1s
(node:11172) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file 'C:\My_Files\Projects\MyNoteApp\platforms\android\CordovaLib\build.gradle' line: 84

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> build_ihrdqe7fln9qjqpg3xt8ghgr$_run_closure3$_closure11$_closure12$_closure13$_closure14

* 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 1s
    at ChildProcess.whenDone (C:\My_Files\Projects\MyNoteApp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:11172) 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:11172) [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.

当我cordova platform ls时,我得到了这个输出

Installed platforms:
  android 7.0.0
Available platforms:
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  windows ~5.0.0
  www ^3.12.0

我的Ionic版本为3,我安装了Android SDK Platform-Tools 27。

我也尝试使用PhoneGap构建这个应用程序。通过使用PhoneGap桌面托管应用程序并在我的手机上使用PhoneGap应用程序进行测试时,该应用程序可以正常工作,包括我正在使用的任何本机API(即Toasts)。当我去PhoneGap构建网站并将我的应用程序构建到APK并在我的手机上运行时,我只得到一个白色的屏幕,什么都没有出现。

0 个答案:

没有答案
相关问题