B
B
BonBon Slick2020-07-31 14:10:45
Apache Cordova
BonBon Slick, 2020-07-31 14:10:45

Why Cordova - FAILURE: Build failed with an exception?

1 minute ago the assembly took place, but the screen hung, made a reboot.

We collect the project.

[email protected]:/var/www/test/cordova$ cordova clean
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=$HOME/Android/Sdk (recommended setting)
ANDROID_HOME=/usr/lib/android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
WARNING: The specified Android SDK Build Tools version (24.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '24.0.0'" from your build.gradle file, as each version of the Android Gradle ...
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
  
  Using Android SDK: /usr/lib/android-sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
/var/www/test/cordova/platforms/android/gradlew: Command failed with exit code 1

[email protected]:/var/www/test/cordova$ cordova clean
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=$HOME/Android/Sdk (recommended setting)
ANDROID_HOME=/usr/lib/android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
WARNING: The specified Android SDK Build Tools version (24.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
...

> Configure project :CordovaLib
WARNING: The specified Android SDK Build Tools version (24.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
...
BUILD SUCCESSFUL in 1s
3 actionable tasks: 3 up-to-date


as you can see, some kind of magic, just enter the same command right away, and we have a wedge up

and here's a little more magic, 1 minute ago the assembly worked, clean above works on the same principle.
[email protected]:/var/www/test$ yarn cordova
yarn run v1.22.0
$ sh run.cordova.android.sh npx cordova platform add android
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1596193148811-0.17091217711617812/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] generate /var/www/test
> nuxt generate

ℹ Production build                                                                                                                                                                                                           13:59:09
✔ Builder initialized                                                                                                                                                                                                        13:59:09
✔ Nuxt files generated                                                                                                                                                                                                       13:59:09

✖ Client
  Compiled with some errors in 13.94s


Hash: 83ae5ac9fcc034e4e7d6
Version: webpack 4.41.6
Time: 13940ms
Built at: 07/31/2020 1:59:24 PM
                  Asset       Size  Chunks               Chunk Names
....         
      fonts/f511123.ttf    825 KiB                       
Entrypoint app = b3ee41f594830c231c32.js a1efb1a7816e174b4485.js 36db55fe93ea6276af67.js 17954b2388388a4714b1.js

WARNING in ./pages/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vuetify-loader/lib/loader.js??ref--16-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&) 30:12-19
"export 'default' (imported as 'stepper') was not found in '../cordova/plugins/cordova-plugin-stepper/www/stepper'
...
 @ multi ./.nuxt/client.js

WARNING in ./pages/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vuetify-loader/lib/loader.js??ref--16-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&) 43:6-13
"export 'default' (imported as 'stepper') was not found in '../cordova/plugins/cordova-plugin-stepper/www/stepper'
...
 @ multi ./.nuxt/client.js

ERROR in ./cordova/plugins/cordova-plugin-stepper/www/stepper.js
Module not found: Error: Can't resolve 'cordova/exec' in '/var/www/test/cordova/plugins/cordova-plugin-stepper/www'
 @ ./cordova/plugins/cordova-plugin-stepper/www/stepper.js 3:11-34
 @ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vuetify-loader/lib/loader.js??ref--16-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
...
 @ multi ./.nuxt/client.js

 FATAL  Nuxt build error                                                                                                                                                                                                     13:59:24

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5326:21)
  at process._tickCallback (internal/process/next_tick.js:68:7)


   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate: `nuxt generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] generate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bonbon/.npm/_logs/2020-07-31T10_59_24_215Z-debug.log
sed: can't read nuxt/*.json: No such file or directory
assets            components  dist     jsconfig.json  middleware  node_modules    package.json       pages    README.md               server.crt  static  tests
build.cordova.sh  cordova     helpers  layouts        mixins      nuxt.config.js  package-lock.json  plugins  run.cordova.android.sh  server.key  store   yarn.lock
npm WARN [email protected] No repository field.

audited 125 packages in 1.323s

1 package is looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Removing android from cordova.platforms array in package.json
Using cordova-fetch for [email protected]^8.0.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
...
        Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
...
Installing "cordova-plugin-stepper" for android
Installing "cordova-plugin-whitelist" for android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=$HOME/Android/Sdk (recommended setting)
ANDROID_HOME=/usr/lib/android-sdk (DEPRECATED)




  Using Android SDK: /usr/lib/android-sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
/var/www/test/cordova/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[email protected]:/var/www/test$


a bunch of errors due to restarting the pc.

1 - why did everything fly off?
Is 2 the norm for cordova?
3 - will it be every time after reboot?
4 - how can you avoid such a norm (hundreds of errors and build failure after reboot)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2020-07-31
@BonBonSlick

1 - it crashed because the android license needs to be added to the script for auto-accepting licenses or by hand every time
2 - nuxt build because you can’t import cordova plugins directly how to do it right, I’ll find out later.
While the options all give out Undefined

const { Stepper } = window;
                console.log(`Stepper`,Stepper); // undefined
                console.log(`cordova`,cordova); // undefined
                console.log(`this.cordova`,this.cordova); // undefined
                console.log(`window.cordova`,window.cordova); // undefined

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question