Cannot create/insert in new table: android.database.sqlite.SQLiteException: no such table: "TableName"
See original GitHub issueDBFlow Version: 4.0.0-beta1 Issue Kind (Bug, Question, Feature): Question
Description: I was using DBflow for my models. After a long time I decided to add an extra model, But I am not able to do so. I am getting an exception saying “No such table”. I tried cleaning the project, selecting “make project” and building again. Previously created models are working without any issue.
10-18 13:24:07.410 1547-1547/com.test.app E/SQLiteLog: (1) no such table: DummyTest 10-18 13:24:07.414 1547-1547/com.test.app D/AndroidRuntime: Shutting down VM 10-18 13:24:07.424 1547-1547/com.test.app E/AndroidRuntime: FATAL EXCEPTION: main Process: com.test.app, PID: 1547 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.app/com.test.app.HomeActivity}: android.database.sqlite.SQLiteException: no such table: DummyTest (code 1): , while compiling: INSERT INTO
DummyTest
(name
) VALUES (?) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2452) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535) at android.app.ActivityThread.access$900(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:152) at android.app.ActivityThread.main(ActivityThread.java:5497) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.database.sqlite.SQLiteException: no such table: DummyTest (code 1): , while compiling: INSERT INTODummyTest
(name
) VALUES (?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1006) at com.raizlabs.android.dbflow.structure.database.AndroidDatabase.compileStatement(AndroidDatabase.java:59) at com.raizlabs.android.dbflow.structure.ModelAdapter.getInsertStatement(ModelAdapter.java:64) at com.raizlabs.android.dbflow.structure.ModelAdapter.getInsertStatement(ModelAdapter.java:51) at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.insert(ModelSaver.java:83) at com.raizlabs.android.dbflow.structure.ModelAdapter.insert(ModelAdapter.java:128) at com.raizlabs.android.dbflow.structure.BaseModel.insert(BaseModel.java:95) at com.test.app.HomeActivity.onCreate(HomeActivity.java:122) at android.app.Activity.performCreate(Activity.java:6285) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535) at android.app.ActivityThread.access$900(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:152) at android.app.ActivityThread.main(ActivityThread.java:5497) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 10-18 13:24:07.424 1547-1547/? D/AppTracker: App Event: crash
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top GitHub Comments
Sorry It just struck for me to uninstall and reinstall the app so that database gets deleted and created from the scratch (Guess this is same as increasing the database version number). I tried now and its working. Thank you
Hi, Have you increased your database version number?