Open iannisacksson opened 4 years ago
Can you provide the full command output?
Hi @dwieeb, the error that appears when trying to access the phone's camera feature. This error is displayed in the chrome://inspect/
Output:
core.js:6210 ERROR Error: Uncaught (in promise): cordova_not_available
at resolvePromise (zone-evergreen.js:798)
at resolvePromise (zone-evergreen.js:750)
at zone-evergreen.js:860
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:41709)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at drainMicroTaskQueue (zone-evergreen.js:569)
I meant the output in your terminal.
Oh yes, sorry!
At the terminal the exit was successful without any changes.
❯ ionic cordova run android --emulator --livereload
> ng run app:ionic-cordova-serve --host=localhost --port=8100 --platform=android
[ng] chunk {} 0.js, 0.js.map () 22.1 kB [rendered]
[ng] chunk {appointments-progress-appointments-progress-module} appointments-progress-appointments-progress-module.js, appointments-progress-appointments-progress-module.js.map (appointments-progress-appointments-progress-module) 11.4 kB [rendered]
[ng] chunk {common} common.js, common.js.map (common) 40.7 kB [rendered]
[ng] chunk {core-js-js} core-js-js.js, core-js-js.js.map (core-js-js) 78.7 kB [rendered]
[ng] chunk {css-shim-978387b1-1e75855f-js} css-shim-978387b1-1e75855f-js.js, css-shim-978387b1-1e75855f-js.js.map (css-shim-978387b1-1e75855f-js) 21.9 kB [rendered]
[ng] chunk {default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~1db96c42} default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~1db96c42.js, default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~1db96c42.js.map (default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~1db96c42) 165 kB [rendered]
[ng] chunk {default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~7589aa84} default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~7589aa84.js, default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~7589aa84.js.map (default~pages-forgot-password-forgot-password-module~pages-home-home-module~pages-login-login-module~7589aa84) 326 kB [rendered]
[ng] chunk {dom-76cc7c7d-0a082895-js} dom-76cc7c7d-0a082895-js.js, dom-76cc7c7d-0a082895-js.js.map (dom-76cc7c7d-0a082895-js) 19.8 kB [rendered]
[ng] chunk {dom-js} dom-js.js, dom-js.js.map (dom-js) 20.2 kB [rendered]
[ng] chunk {finalized-appointments-finalized-appointments-module} finalized-appointments-finalized-appointments-module.js, finalized-appointments-finalized-appointments-module.js.map (finalized-appointments-finalized-appointments-module) 11.5 kB [rendered]
[ng] chunk {focus-visible-70713a0c-js} focus-visible-70713a0c-js.js, focus-visible-70713a0c-js.js.map (focus-visible-70713a0c-js) 2.15 kB [rendered]
[ng] chunk {hardware-back-button-5afe3cb0-js} hardware-back-button-5afe3cb0-js.js, hardware-back-button-5afe3cb0-js.js.map (hardware-back-button-5afe3cb0-js) 2.06 kB [rendered]
[ng] chunk {input-shims-a4fc53ac-js} input-shims-a4fc53ac-js.js, input-shims-a4fc53ac-js.js.map (input-shims-a4fc53ac-js) 13.5 kB [rendered]
[ng] chunk {ios-transition-1850e475-js} ios-transition-1850e475-js.js, ios-transition-1850e475-js.js.map (ios-transition-1850e475-js) 27.8 kB [rendered]
[ng] chunk {main} main.js, main.js.map (main) 35.2 kB [initial] [rendered]
[ng] chunk {md-transition-083fcf52-js} md-transition-083fcf52-js.js, md-transition-083fcf52-js.js.map (md-transition-083fcf52-js) 3.91 kB [rendered]
[ng] chunk {new-appointments-new-appointments-module} new-appointments-new-appointments-module.js, new-appointments-new-appointments-module.js.map (new-appointments-new-appointments-module) 11 kB [rendered]
[ng] chunk {pages-forgot-password-forgot-password-module} pages-forgot-password-forgot-password-module.js, pages-forgot-password-forgot-password-module.js.map (pages-forgot-password-forgot-password-module) 17.2 kB [rendered]
[ng] chunk {pages-home-home-module} pages-home-home-module.js, pages-home-home-module.js.map (pages-home-home-module) 27.8 kB [rendered]
[ng] chunk {pages-login-login-module} pages-login-login-module.js, pages-login-login-module.js.map (pages-login-login-module) 24.8 kB [rendered]
[ng] chunk {pages-map-map-module} pages-map-map-module.js, pages-map-map-module.js.map (pages-map-map-module) 15.4 kB [rendered]
[ng] chunk {pages-products-products-module} pages-products-products-module.js, pages-products-products-module.js.map (pages-products-products-module) 19.2 kB [rendered]
[ng] chunk {pages-profile-profile-module} pages-profile-profile-module.js, pages-profile-profile-module.js.map (pages-profile-profile-module) 43.6 kB [rendered]
[ng] chunk {pages-register-register-module} pages-register-register-module.js, pages-register-register-module.js.map (pages-register-register-module) 144 kB [rendered]
[ng] chunk {pages-schedules-schedules-module} pages-schedules-schedules-module.js, pages-schedules-schedules-module.js.map (pages-schedules-schedules-module) 12.4 kB [rendered]
[ng] chunk {personal-data-personal-data-module} personal-data-personal-data-module.js, personal-data-personal-data-module.js.map (personal-data-personal-data-module) 9.41 kB [rendered]
[ng] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 142 kB [initial] [rendered]
[ng] chunk {product-create-product-create-module} product-create-product-create-module.js, product-create-product-create-module.js.map (product-create-product-create-module) 10.2 kB [rendered]
[ng] chunk {product-delete-product-delete-module} product-delete-product-delete-module.js, product-delete-product-delete-module.js.map (product-delete-product-delete-module) 24.6 kB [rendered]
[ng] chunk {product-edit-product-edit-module} product-edit-product-edit-module.js, product-edit-product-edit-module.js.map (product-edit-product-edit-module) 25.7 kB [rendered]
[ng] chunk {runtime} runtime.js, runtime.js.map (runtime) 11.2 kB [entry] [rendered]
[ng] chunk {shadow-css-4889ae62-23996f3f-js} shadow-css-4889ae62-23996f3f-js.js, shadow-css-4889ae62-23996f3f-js.js.map (shadow-css-4889ae62-23996f3f-js) 14.8 kB [rendered]
[ng] chunk {status-tap-839e1402-js} status-tap-839e1402-js.js, status-tap-839e1402-js.js.map (status-tap-839e1402-js) 1.79 kB [rendered]
[ng] chunk {styles} styles.js, styles.js.map (styles) 95 kB [initial] [rendered]
[ng] chunk {swipe-back-c7acdfde-js} swipe-back-c7acdfde-js.js, swipe-back-c7acdfde-js.js.map (swipe-back-c7acdfde-js) 2.68 kB [rendered]2m
[ng] chunk {swiper-bundle-ccdaac54-js} swiper-bundle-ccdaac54-js.js, swiper-bundle-ccdaac54-js.js.map (swiper-bundle-ccdaac54-js) 176 kB [rendered]
[ng] chunk {tap-click-606f325e-js} tap-click-606f325e-js.js, tap-click-606f325e-js.js.map (tap-click-606f325e-js) 6.38 kB [rendered]
[ng] chunk {vendor} vendor.js, vendor.js.map (vendor) 4.27 MB [initial] [rendered]
[ng] Date: 2020-04-30T12:59:43.017Z - Hash: b718d389a6f0768af8b9 - Time: 20522ms
[INFO] ... and 76 additional chunks
[ng] : Compiled successfully.
[INFO] Development server running!
Local: http://localhost:8100
Use Ctrl+C to quit this process
> cordova build android --emulator
> native-run android --app platforms/android/app/build/outputs/apk/debug/app-debug.apk --virtual --forward 8100:8100
[native-run] Selected emulator emulator-5554
[native-run] Forwarded device port 8100 to host port 8100
[native-run] Installing platforms/android/app/build/outputs/apk/debug/app-debug.apk...
[native-run] Starting application activity io.ionic.starter/io.ionic.starter.MainActivity...
[native-run] Run Successful
Thanks! Okay, I see it's running the correct thing: ng run app:ionic-cordova-serve
Just FYI, your CLI is out of date (see upgrade instructions).
The cordova_not_available
error seems to only happen when cordova.js
isn't being included. With the DevTools, if you inspect the HTML, can you see if it's there? I am trying to narrow down where the issue could be.
@dwieeb, thanks for helping me and I updated my CLI, Thanks :smile:.
I inspected the HTML and didn't find cordova.js there. How do I include it?
The ionic-cordova-serve
runner should be including it. If you run ionic build
(which should run ng run app:ionic-cordova-build
) do you see it in the index.html file it creates? If not, this may be an issue for the Angular toolkit: https://github.com/ionic-team/angular-toolkit
Maybe I should open a new issue but rootcause could be the same, the behavior is also the same for capacitor + reactjs configuration:
ionic capacitor run android --https --consolelogs --external
- cordova works
ionic capacitor run android --https --consolelogs --external --livereload
- cordova_not_available
Ionic:
Ionic CLI : 6.7.0 (/home/cdtj/node/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 5.1.0
Capacitor:
Capacitor CLI : 2.0.2
@capacitor/core : 2.0.2
Utility:
cordova-res : not installed
native-run : 1.0.0
System:
NodeJS : v13.12.0 (/home/cdtj/node/bin/node)
npm : 6.14.4
OS : Linux 5.3
npx cap sync android
output:
✔ Copying web assets from build to android/app/src/main/assets/public in 96.54ms
✔ Copying native bridge in 1.42ms
✔ Copying capacitor.config.json in 1.04ms
Found 4 Cordova plugins for android
cordova-plugin-file (6.0.2)
cordova-plugin-file-opener2 (3.0.1)
cordova-plugin-geolocation (4.0.2)
phonegap-plugin-barcodescanner (8.1.0)
✔ copy in 178.42ms
✔ Updating Android plugins in 16.43ms
Found 0 Capacitor plugins for android:
Found 4 Cordova plugins for android
cordova-plugin-file (6.0.2)
cordova-plugin-file-opener2 (3.0.1)
cordova-plugin-geolocation (4.0.2)
phonegap-plugin-barcodescanner (8.1.0)
✔ update android in 89.12ms
Sync finished in 0.281s
@cdtj It's happening with Capacitor + Angular as well so it seems a somewhat generic issue Is there any known workaround?
EDIT: I don't know how I fixed but I did it. I just performed an npx cap sync before the live reload and ionic capacitor update once the server was live. So I don't know which one fixed it
Description: I'm running the command
ionic cordova run android --emulator --livereload
to emulate the application on an Android emulator, the native functions are stopping and have the following error message on the consolecordova_not_available
. For example, when I try to open the cameraBut when I remove the command
--livereload
, the native functions return to working normally.My
ionic info
:Other Information: