react-native-sqlite-storage如何打开指定的目录文件?

问题描述 投票:1回答:1

我的数据库:android\app\src\main\assets\app.db

我尝试的方式:

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

但是错误:

image

我该怎么做?

sqlite react-native react-native-android react-native-sqlite-storage
1个回答
0
投票

运行吧!

 open() {
    SQLiteStorage.DEBUG(true);
    SQLiteStorage.openDatabase({
      name: 'app.db', // android/app/src/main/assets/app.db
    })
      .then(() => {
        console.info('');
      })
      .catch(err => {
        console.warn(err);
      });
  }
© www.soinside.com 2019 - 2024. All rights reserved.