Native plugins dont load when android run with --livereload


#1

Hello,

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.

Thanks,


#2

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


#3

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

System:

    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

Misc:

    backend : pro


#4

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: https://ionic.zone/debug/remote-debug-your-app#android 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)


#5

Thanks,

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


#6

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


#7

Yes, I did the same way as advised.


#8

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


#9

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


#10

Sorry for the late reply. Have a look at this: https://github.com/ionic-team/ionic-app-scripts/issues/1354