ionic-conference-app: Could not find cordova.js script tag. Plugin loading may fail on android device

I’m submitting a … (check one with “x”) [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

starting the app

Expected behavior:

see home page

Steps to reproduce:

Related code:

ionic cordova run android --prod

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Ionic:

   ionic (Ionic CLI)             : 4.2.1 (C:\Users\albemaes\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.11
   @angular-devkit/build-angular : 0.7.5
   @angular-devkit/schematics    : 0.7.5
   @angular/cli                  : 6.1.5
   @ionic/angular-toolkit        : not installed

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : not available
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 5 other plugins)

System:

   NodeJS : v8.11.1 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 19

Most upvoted comments

Facing the same issue. But only with the --prod flag.

I corrected this problem In angular.json, I set buildOptimizer and AoT to false, then I was able to build with --prod. When I reactivated AoT, I see the problem in the log. The dependency injection was doing the wrong way during the migration.

Same problem, After spend a lot of time. I saw that I was calling the configurationPush method before get the ready callback of platform. after change this, everything starts working.

thinking about it. when the build optimizations runs, this can change the order of a lot of things. so can make the configurations run before the cordova already be prepared.

Hope help

Same problem, After spend a lot of time. I saw that I was calling the configurationPush method before get the ready callback of platform. after change this, everything starts working.

thinking about it. when the build optimizations runs, this can change the order of a lot of things. so can make the configurations run before the cordova already be prepared.

Hope help

Hello, I have same problem. Could you more detail about your solution. I couldn’t understand configurationPush method. What is its location. ı couldn’t find it. If you give more details, I wil be happy. Thank you for your help.

@yoginm Could you describe where to put the findCordovaPath() function ? Thanks.

findCordovaPath() you can find here: [your app root folder] > www > cordova.js The thing is that this file is generated & overwritten during build, therefore changes will have no impact. (Although I was able to build once with –prod where it worked, but it was not reproduceable.

My colleagues at work have an ionic 4 project where prod builds work as expected, without changing anything on the cordova.js. Our project we just migrated from ionic 3 and prod builds are not working. Very frustrating…

I am facing this issue in --prod – release it works on --prod I try @yoginm solution but still facing a problem. Can some help me out.

I found a solution… The following findCordovaPath function will work with hashed builds.

function findCordovaPath () { var path = null; var scripts = document.getElementsByTagName(‘script’); var startterm = ‘/cordova.’; var term = ‘/cordova.js’; for (var n = scripts.length - 1; n > -1; n–) { var src = scripts[n].src.replace(/?.*$/, ‘’); // Strip any query param (CB-6007). var idx = src.indexOf(startterm); if (idx >= 0){ term = src.substring(idx+1); } if (src.indexOf(term) === (src.length - term.length)) { path = src.substring(0, src.length - term.length) + ‘/’; break; } } return path; }