apache / cordova-js

Apache Cordova JavaScript Bridge
https://cordova.apache.org/
Apache License 2.0
631 stars 836 forks source link

Could not find cordova.js script tag #238

Closed guntercn closed 2 months ago

guntercn commented 2 years ago

Bug Report

Problem

running my app in a android device, the splashscreen never hide. cheking the adb catlog, there are 3 main errors:

Error I chromium: [INFO:CONSOLE(1)] "Uncaught Reference Error: globalThis is not defined", source: http://localhost/main.b5e1b42bf56f00a f562e.js (1)

I chromium: [INFO:CONSOLE(1)] "Could not find cordova.js script tag. Plugin loading may fail.", source: http://localhost/cordova.5687a8f7461b757f98c1.js (1)

I chromium: [INFO:CONSOLE(1)] "Ionic Native: deviceready event fired after 632 ms", source: http://localhost/main.b5e1b42bf56f00a f562e.js (1)

Environment, Platform, Device

Ionic:

Ionic CLI : 6.16.1 (C:\Users\User\AppData\Roaming\npm\n ode_modules\@ionic\cli) Ionic Framework : @ionic/angular 5.6.11 @angular-devkit/build-angular : 12.0.5 @angular-devkit/schematics : 12.0.5 @angular/cli : 12.0.5 @ionic/angular-toolkit : 4.0.0

Cordova:

Cordova CLI : 10.0.0 Cordova Platforms : not available Cordova Plugins : not available

Utility:

cordova-res : 0.15.3 native-run (update available: 1.4.0) : 1.3.0

Any Help? Thanks!

jcesarmobile commented 2 months ago

Your index.html has to include the cordova.js script tag for plugins to work, is not something Cordova does, you have to do it.

If using Ionic CLI or other tooling, the tooling should add the cordova.js script link. As far as I know, Ionic CLI adds it on ionic cordova prepare command and probably in build and run commands too.