Odoo-mobile / framework

Odoo Mobile Framework
https://play.google.com/store/apps/dev?id=8607973775002477408
Other
327 stars 374 forks source link

E/SQLiteLog: no such table [table_name] #361

Open bimajatiwijaya opened 6 years ago

bimajatiwijaya commented 6 years ago

Error E/SQLiteLog: no such table [table_name] To solve this error i have to clear data and cache to make it run again. I think we should improve it.

LOG :

`Attempt to invoke virtual method 'java.lang.String com.odoo.core.orm.OModel.getModelName()' on a null object reference FATAL EXCEPTION: ModernAsyncTask #1

BaseModelProvider.java:92 BaseModelProvider.java:85 BaseModelProvider.java:108

Any clue why this happened and how to prevent this bug occurs ?

sylwek845 commented 6 years ago

if you go to java->com->"your package name" ->data -> OConstants you should see this just above DATABASE_VERSION var

  • Database version. Required to change in increment order
    • when you change your database model in case of released apk.
    • When dealing with DATABASE_VERSION, you need to override onModelUpgrade() method
    • in each of the model class for applying upgrade script for that model.

this is because database is created only on first app use to fix this problem you need to override onModelUpgrade method and run your upgrade script as stated in the quote above.

so when you add new field in one of your models you should change DATABASE_VERSION to +1 and then create your upgrade script and it should fix your problem.

kasim1011 commented 6 years ago

@bimajatiwijaya Make sure your Instant run option is turned off.