sqlitereact-nativereact-native-sqlite-storage

react-native-sqlite-storage How to open the specified directory file?


my db in: android\app\src\main\assets\app.db

The way i tried:

  open() {
    SQLiteStorage.DEBUG(true);
    SQLiteStorage.openDatabase({
      name: 'file:///android_asset/app.db',
    })
      .then(() => {
        console.info('');
      })
      .catch(err => {
        console.warn(err);
      });
  }

But error:

image

How can i do this?


Solution

  • run ok!

     open() {
        SQLiteStorage.DEBUG(true);
        SQLiteStorage.openDatabase({
          name: 'app.db', // android/app/src/main/assets/app.db
        })
          .then(() => {
            console.info('');
          })
          .catch(err => {
            console.warn(err);
          });
      }