Cordova is only missing at Live Reload on Device?

Hi there,

no, it’s not really missing, but if I start the project with

ionic cordova run --device android --livereload

Without live reloading, the app seems to find the cordova.js file. I can see it at the missing console error logs, when I connect to the device in Google Chrome with


Soo … Where’s Cordova … or better: Why is it missing at live reload on device, but not on normal build/run without live reload?

Even none of the native plugins are processing at live reloading on a real device or emulator (when Cordova is missing) … naaagh :confused:

For your interest, Ionic Info says this:

cli packages: (C:\Users\B\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 7.0.0 browser 5.0.3
Ionic Framework    : ionic-angular 3.9.2


Android SDK Tools : 26.1.1
Node              : v6.11.0
npm               : 3.10.10
OS                : Windows 7

Environment Variables:

ANDROID_HOME : C:\Users\B\AppData\Local\Android\sdk


backend : legacy

Experiencing precisely the same problem. Testing the ionic-native geolocation plugin on Android with livereload results fails on device, works on browser.

Works fine without livereload.

This is the console output, when I


the app I started with

ionic cordova run android --emulator

And it doesn’t matter, if it’s the contacts plugin. It can be any native plugin. The problem is that cordova.js is missing, no matter if it’s running on device or emulator.

Native: tried accessing the Contacts plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
(anonymous) @ ion-dev.js:156
ion-dev.js:156 ERROR Error: Uncaught (in promise): cordova_not_available
at c (polyfills.js:3)
at c (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:4973)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at o (polyfills.js:3)
at e.invokeTask [as invoke] (polyfills.js:3)
at p (polyfills.js:2)

This error does NOT appear, when I do NOT use the livereload option, because THEN the cordova.js exists and is not missing.

Or is it an ionic (angular?) default behaviour to not use cordova.js at any livereload stages?

Look at this …

Worked in my case

This solution worked for me, just remember to remove it before production:

Hello! Before days ago i had this problem and, most solutions not works for me. After tests and searchs, i finded another solution and this works for me!

Edit file node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js and change last line to:

exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app/src/main', 'assets', 'www');

In bad case, run ionic cordova platform remove android and add again.

I expect this works for you!