Hi.
I need to use existing SQLite file for my app, and for offline support, so I did following things:
- add “assetBundlePatterns” in app.json .
- Assets.loadAsync(“./assets/db/db.db”) to load db file
- FilesSystem.copyAsync({
from:Assets.fromModule(“./assets/db/db.db”).localUri,
to:FileSystem.documentDirectory + “/db/db.db”
}) to copy db file.
on step 3,
I have no problem and can copy files with my device and simulator successfully on Expo XDE,
but it fails to copy the file on a standalone app after build (with expo build:android).
when I check the Assets.fromModule.localUri, it starts with “asset://”, not “file://”.
Expo document says FileSystem uses uri starting with ‘file://’, and the same Assets’ localUri on Expo XDE starts with ‘file://’.
I think it is the problem.
Is there any bypass or any correct way to copy using Assets.localUri in standalone app?
Thanks.