Ionic-app-scripts: Livereload not reloading native/plugin (SQLite)

Created on 24 Sep 2017  路  6Comments  路  Source: ionic-team/ionic-app-scripts

Short description of the problem:

Once I use the run command while testing my App, it runs fine, debug also shows it seems to be working. Once I change the code and it reloads and I get the following error on Chrome Debug.
plugin_not_installed

What behavior are you expecting?

For it to keep the plugin loaded or working.

Steps to reproduce:

  1. ionic cordova run android --livereload // it works
  2. save a file to trigger a reload // it doesn't work anymore
  3. You can terminate the process and run steps 1 and 2 again
insert any relevant code between the above and below backticks
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
class DB {
    private db: any = SQLiteObject;
    constructor(){
        var sqlite = new SQLite();
        sqlite.create({
            name: 'name.db',
            location: 'default'
        })
        .then((DBO: SQLiteObject) => {
            this.db = DBO;
        })
        .catch(e => console.log(e));    //The plugin_not_installed error comes from here
    }
}
export default new DB();

Which @ionic/app-scripts version are you using?

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

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node : v6.11.3
    npm  : 5.4.2
    OS   : Windows 10

Misc:

    backend : pro

While it's not showing, SQLlite plugin is also installed and working, since it works the first time.

Most helpful comment

i'm so sorry, work fine after platform ready event!

All 6 comments

i have same problem :(

i'm so sorry, work fine after platform ready event!

Look inside your services(@Injectable), they are singleton and start with the application;

I have the same problem, did someone find a solution?

@Kahel3352 The problem happens because Ionic has not yet loaded the SQLite plugin. To control the flow of the application use the "platform.ready ()"

Sorry, I don't understand. What should I do with platform.ready()?

Was this page helpful?
0 / 5 - 0 ratings