Closed Applizone closed 2 years ago
At targetting SDK 30, what I've done is removing content from
react-native.config.js
module.exports = {
dependencies: {
"react-native-sqlite-storage": {
platforms: {
android: {
sourceDir: "../node_modules/react-native-sqlite-storage/platforms/android-native",
packageImportPath: "import io.liteglue.SQLitePluginPackage;",
packageInstance: "new SQLitePluginPackage()"
}
}
}
}
};
I also removing import io.liteglue.SQLitePluginPackage;
from MainApplication.java
and the database can open finally.
At targetting SDK 30, what I've done is removing content from
react-native.config.js
module.exports = { dependencies: { "react-native-sqlite-storage": { platforms: { android: { sourceDir: "../node_modules/react-native-sqlite-storage/platforms/android-native", packageImportPath: "import io.liteglue.SQLitePluginPackage;", packageInstance: "new SQLitePluginPackage()" } } } } };
I also removing
import io.liteglue.SQLitePluginPackage;
fromMainApplication.java
and the database can open finally.
FTS5 will not work if you do this one
I have install and tried several ways but still unable to connect database. My database is pre-defined that I create using DB Browser.
Expected Behavior
Database should be able to open at the very first place.
Current Behavior
Database cannot open
Possible Solution
Steps to Reproduce (for bugs)
I have post in StackOverflow too
Context
I cannot start any transaction
Your Environment
Samsung Galaxy Android 11, "react-native-sqlite-storage": "^6.0.1", "react": "17.0.2", "react-native": "0.65.1", "@react-navigation/native": "^6.0.4",
Debug logs Android 11 (Samsung Galaxy A71)
LOG OPEN database: mysqlite.db LOG SQLite.open({"name":"mysqlite.db","createFromLocation":"~mysqlite.db","dblocation":"nosync","assetFilename":"~mysqlite.db"}) LOG new transaction is waiting for open operation LOG Phone connected? true, Server connected? true LOG OPEN database: mysqlite.db failed, aborting any pending transactions LOG [Error: Could not open database]
Debug logs Android 9 (Redmi 6)
LOG OPEN database: mysqlite.db LOG SQLite.open({"name":"mysqlite.db","createFromLocation":"~mysqlite.db","dblocation":"nosync","assetFilename":"~mysqlite.db"}) LOG new transaction is waiting for open operation LOG Phone connected? true, Server connected? true LOG Connection success! LOG SQLite.backgroundExecuteSqlBatch({"dbargs":{"dbname":"mysqlite.db"},"executes":[{"qid":1111,"sql":"BEGIN","params":[]},{"qid":1111,"sql":"SELECT * FROM MSCRAP","params":[]}]}) LOG YEAY FINALLY LOG item: 0 LOG [] LOG SQLite.backgroundExecuteSqlBatch({"dbargs":{"dbname":"mysqlite.db"},"executes":[{"qid":1111,"sql":"COMMIT","params":[]}]})