Ионная сборка cordova android выдает ошибку «UnhandledPromiseRejectionWarning: Ошибка: cmd: Команда завершилась неудачно с кодом выхода 1» - PullRequest
0 голосов
/ 26 апреля 2018

Я пытаюсь построить и ионный проект в виде 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

Моя Ионная версия - 3, и у меня установлен Android SDK Platform-Tools 27.

Я также пытался создать это приложение, используя PhoneGap. При тестировании с размещением приложения на рабочем столе PhoneGap и с помощью приложения PhoneGap на моем телефоне приложение работает нормально, включая любой используемый мной нативный API (т. Е. Тосты). Когда я захожу на сайт сборки PhoneGap и встраиваю свое приложение в APK и запускаю его на своем телефоне, у меня появляется только белый экран, и ничего не появляется.

...