Pre-populated DB, after sync is missing from Android. Where is www folder?

Hi All,
I’m a novice, but I have a problem with my SQL3Lite pre-populated DB and IONIC5, with Capacitor.

I put my database.db file into Ionic project, into folder SRC/ASSETS (not into www folder because framework cleans and refreshes it at every compile or sync phase).

After a cap sync, that file appears into the android project folder:

But in run-time, when I use method this.sqliteDbCopy.copy( ‘database.db’, 0) in my Angular service, I catch only a message with code 400 and text with: message:www/database.db.
I suppose that the copy funtion doesn’t find the database file or the folder www or the correct path.
The copy function creates only a new empty database.db files in the correct database folder destination.

I tried to move the original database.db file in everywhere, among Android folders, but nothing.
Would you try to help me?

The copy is from import { SqliteDbCopy } from ‘@ionic-native/sqlite-db-copy/ngx’;


Debbugging into Android I’ve discovered that the www corresponds to public !

myInput = cordova.getActivity().getAssets().open(“www/” + dbName);


myInput = cordova.getActivity().getAssets().open(“public/” + dbName);

and plugin runs on Android with Capacitor on Ionic5,

I change it into my Android project, but I suggest our friends to change it into the gitHub.

I’dont know if there are other differences among android versions…

I’solved several matters before, well explained starting from the topic:

Thank you to all!

1 Like