Ionic 4 - Native: tried accessing the SQLite plugin but it's not installed

Hey guys,

I’m facing today some odd problems.

My Ionic version was 4.9.0 + some other plugins + sqlite and everything was ok.
Now today I’ve updated ionic to 4.12.0 and I get the error message:
“Native: tried accessing the SQLite plugin but it’s not installed.” although the plugin is already installed.

I’ve done this so far to solve the problem but this hasn’t helped.

  1. uninstall sqlite and install again
  2. uninstall android platform and install again
  3. downgrade ionic to 4.9.0 and then step 1 and step 2

I’m still getting the same error.

Does anyone else have this issue?

Thanks

Guys any help??? :worried::worried::worried:

What I could find out was, that this problem is apparently only on Android phones with Android 8.1 and Android 9.
But still couldn’t find any solution for that :frowning:

I could finally solve the problem.

After uninstalling and installing the plugin and android platform in different version etc… which didn’t help.

I figured out that the device ready in app.component.ts is apparently not enough to make sure that the device is “really” ready. since I use the database as a service I had to put the device ready stuff in my service constructor and now it works.

this is my constructor in the databse service:

constructor(
        private sqlite: SQLite,
        private platform: Platform
    ) {
        this.platform.ready().then(() => {
            this.createDatabaseObject();
        });
    }

createDatabaseObject(): void {
        this.sqlite.create({
            name: this.databaseName,
            location: this.databaseLocation
        }).then((db : SQLiteObject) => {
            this.dbHandler = db;
            this.createTables();
        });
    }
2 Likes