Native plugins dont load when android run with --livereload


When I run the command: ionic cordova run android --prod --aot --livereload

The app starts but cordova object in window is not available. The app works fine but any native plugin does not work and Ionic Native warns, plugin not installed.

But, if I run the app with livereload flag dropped, the app works great and native functions are available.

I’m using android engine version 7.0.0.

config.xml excerpt

<engine name="android" spec="^7.0.0" />

package.json excerpt

"dependencies": {
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/compiler-cli": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/platform-browser-dynamic": "4.4.6",
    "@ionic-native/core": "4.4.2",
    "@ionic-native/diagnostic": "4.5.0",
    "@ionic-native/file": "4.5.0",
    "@ionic-native/file-opener": "4.5.2",
    "@ionic-native/file-transfer": "4.5.0",
    "@ionic-native/push": "4.5.2",
    "@ionic-native/splash-screen": "4.4.2",
    "@ionic-native/status-bar": "4.4.2",
    "angular2-moment": "1.7.0",
    "cordova-android": "^7.0.0",
    "cordova-ios": "4.5.3",
    "cordova-plugin-compat": "1.2.0",
    "cordova-plugin-device": "^1.1.6",
    "cordova-plugin-document-viewer": "0.9.6",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-opener2": "^2.0.19",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-inappbrowser": "^1.7.1",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.3.0",
    "cordova-plugin-whitelist": "^1.3.2",
    "cordova-plugin-x-socialsharing": "^5.2.1",
    "cordova.plugins.diagnostic": "^3.7.2",
    "es6-promise-plugin": "^4.1.0",
    "font-awesome": "4.7.0",
    "ionic-angular": "3.9.2",
    "ionic-gallery-modal": "^0.2.7",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "moment": "2.19.3",
    "phonegap-plugin-push": "^2.1.2",
    "rxjs": "5.5.2",
    "zone.js": "0.8.18"
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.7",
    "typescript": "2.4.2"

Node Version: 7.10.0

Please let me know, if there is something, I’m doing wrong or any packages that need upgrading / downgrading.

Also, if you need more information of my working environment.


Does it work with a virgin, new project created with ionic start?
What is your ionic info output?

yes, cordova does not run in a fresh ionic installation.

Ionic info:

cli packages: (/Users/ankit/.nvm/versions/node/v7.10.0/lib/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.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2


    Android SDK Tools : 25.2.5
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v7.10.0
    npm               : 5.4.2
    OS                : macOS High Sierra
    Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

    ANDROID_HOME : /users/ankit/dev-tools/android-sdk-macosx


    backend : pro

Are you getting any errors with a new Ionic app?

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: Look at the console and network tabs for errors.

(Actually I am not 100% sure that this actually should work… livereload and native plugins at the same time)


The error messages I’m talking about are from a real Android device. iOS works fine.

Yes, you debug those exactly the same way. See the link.

Yes, I did the same way as advised.

@Sujan12 Can you think of any specific reason? I guess, it is because of my environment, but cannot pinpoint why?

I’m having the same - did you find a solution to this?

Sorry for the late reply. Have a look at this: