0
votes

I am getting this error
Caused by: android.database.sqlite.SQLiteException: no such table:
Is there any way to catch it .
I tried with try and catch and not working app is crashing
My code

JsonStroageMilla jsonStroageMilla=new JsonStroageMilla();
jsonStroageMilla.findById(JsonStroageMilla.class,1);

My class

    @Keep
    public class JsonStroageMilla extends SugarRecord {
        public JsonStroageMilla(){

        }
    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    String data,time;
  }


Full error code

FATAL EXCEPTION: main Process: com.valyangadi, PID: 16477 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/ChecckoutActivity062802}: android.view.InflateException: Binary XML file line #23: Binary XML file line #32: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #32: Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.shopify.sample.checkout.ChecckoutActivity062802.onCreate(ChecckoutActivity062802.java:18) at android.app.Activity.performCreate(Activity.java:6245) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5443)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)  Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971) at android.view.LayoutInflater.rInflate(LayoutInflater.java:831) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at com.shopify.sample.checkout.ChecckoutActivity062802.onCreate(ChecckoutActivity062802.java:18)  at android.app.Activity.performCreate(Activity.java:6245)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5443)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)  Caused by: android.database.sqlite.SQLiteException: no such table: JSON_STROAGE_MILLA (code 1): , while compiling: SELECT * FROM JSON_STROAGE_MILLA at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316) at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1163) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1034) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1240) at com.orm.SugarRecord.find(SugarRecord.java:201) at com.orm.SugarRecord.listAll(SugarRecord.java:127) at

2
can you share the code pleaseMosius
And are you sure that the table exists?Mosius
i am using sugar and i don't know how they make tableMidhilaj
we are juest calling object.save() for insert and findbyid for read from sqliteMidhilaj
I think you are not implementing Sugar correctly, anyway I think the try and catch is working and your app is crashing because of some xml layout problemsMosius

2 Answers

1
votes
  • Try disabling instant
  • First uninstall your app from your device/emulator.
  • Then clean the project (Android Studio, Build, Clean Project).
  • Now run your app.
0
votes

Add an empty constructor and make sure you update your database value with 1, so

public JsonStroageMilla() {}

and

<meta-data
android:name="VERSION"
android:value="2"/>