We have a sqlite database in our Application. Its working fine for all the users but few of them experiencing the Caused by: android.database.sqlite.SQLiteException: n
After spending couple of hours I got this solution:
1) Settings > Application Manager
2) Select App
3) Clear Data
4) Uninstall App
Now Run app from Android Studio
Hope this works properly
If you are using GreenDao and get this error, be sure you are unistalling the app and try again. This solved my problem
Suppose if you run your app with Database Version 1, then if you alter the table structure or add a new table, you must increase your Database Version to 2 and further if you make more changes to it.
public class AppDatabase extends SQLiteOpenHelper {
// Database Name
private static final String DATABASE_NAME = "myDatabase";
// Database Version
private static final int DATABASE_VERSION = 1;
public AppDatabase(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
}
Increase this DATABASE_VERSION value if any alterations are done.
1.Change Your DataBase Version Or First Uninstall Your Apps In the Emulator or Phone And Re-install. I In This way Think Your Problem Will be solved.
kindly initiallize copy database or database helper in main class like that Database helper = new Database(this); helper.execute(sqliteobj)
Update the DATABASE_VERSION and uninstall the app. Now run the app.