- Home /
SQLite works fine in Unity Editor but doesn't work in Android device (apk).
Hi guys!. I developed a simple for which I decided to use SQLite as my database. Hence, the database works fine with Unity Editor but doesn't work in Android device (installed using apk file). Have tried multiple solutions but to no avail. These are sample db connection code which I have made in my game:
connectionString = "URI=file:" + Application.dataPath + "/CalorieDB.db";
using (IDbConnection dbConnection = new SqliteConnection (connectionString)) {
string date = DateField.text;
string calories = calorieBurnt;
dbConnection.Open ();
using (IDbCommand dbCmd = dbConnection.CreateCommand ()) {
string sqlQuery = String.Format("INSERT INTO CalorieHistory(Date,CaloriesBurnt) VALUES('"+date+"', '"+calories+"')");
dbCmd.CommandText = sqlQuery;
dbCmd.ExecuteScalar ();
dbConnection.Close ();
My db file is in Assets. I made a Plugin folder in Assets which contains System.Data, sqlite3, Mono.DataSqlite files. I pretty sure I'm missing a few steps that I need to complete. Please kindly provide any working solution. Thank you in advance!
Your answer
Follow this Question
Related Questions
SQLite Transaction Update Problem on Android 0 Answers
Unity sqlite to android: no such table 0 Answers
Sqlite3.dll not found on specific Android devices 2 Answers
Sqlite3.dll not integrated into Android Build 1 Answer
SqlLite , android and unity 1 Answer