Android: Sugar ORM No Such Table Exception

后端 未结 21 1069
一生所求
一生所求 2020-12-05 06:42

I am getting the No Such table exception when i am Using Sugar ORM with GPU image Android Library. I am using Gradle and Android Studio. Once i remove GPU image

21条回答
  •  醉梦人生
    2020-12-05 07:07

    I am using version 1.5 and have tried many ways here but not work.

    And I found the solution!

    This will force to create tables when starting the app:

    public class SugarOrmTestApplication extends SugarApp {
        @Override
        public void onCreate() {
            super.onCreate();
            SugarContext.init(getApplicationContext());
    
            // create table if not exists
            SchemaGenerator schemaGenerator = new SchemaGenerator(this);
            schemaGenerator.createDatabase(new SugarDb(this).getDB());
        }
    
        @Override
        public void onConfigurationChanged(Configuration newConfig) {
            super.onConfigurationChanged(newConfig);
        }
    
        @Override
        public void onLowMemory() {
            super.onLowMemory();
        }
    
        @Override
        public void onTerminate() {
            super.onTerminate();
            SugarContext.terminate();
        }
    }
    

提交回复
热议问题