Android: Sugar ORM No Such Table Exception

后端 未结 21 1070
一生所求
一生所求 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 06:58

    I had this problem. I executed all suggestions posted here. But neither worked. Then I applied all together, and finally got rid of that problem. What I did-

    1. Disabled instant run. (as Parth Vora said.)
    2. Then I added the following class-
    
       import android.app.Application;
       import android.content.res.Configuration;
       import com.orm.SugarApp;
       import com.orm.SugarContext;
    
       public class SugarOrmTestApplication extends SugarApp {
    
          @Override
          public void onConfigurationChanged(Configuration newConfig) {
             super.onConfigurationChanged(newConfig);
          }
    
          @Override
         public void onCreate() {
            super.onCreate();
            SugarContext.init(getApplicationContext());
            Book.findById(Book.class, (long) 1);
         }
    
         @Override
         public void onLowMemory() {
           super.onLowMemory();
         }
    
         @Override
         public void onTerminate() {
           super.onTerminate();
         }
     }
    
     3. Modified manifest file-
        
           
           
           
        
    

    And this is my model class-

    public class Book extends SugarRecord {
       String title;
       String edition;
    
       public Book(){
       }
    
       public Book(String title, String edition){
          this.title = title;
          this.edition = edition;
       }
    }
    

    Now my application works good.

提交回复
热议问题