如何理解这种类型的SQLException

时间:2017-06-29 05:37:42

标签: android sqlite exception insert

我的应用程序在下一个异常时崩溃,没有任何解释:

java.lang.RuntimeException: 
  at android.os.AsyncTask$3.done(AsyncTask.java:300)
  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
  at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
  at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)
Caused by: android.database.sqlite.SQLiteException: 
  at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method:0)
  at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1093)
  at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:670)
  at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
  at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1607)
  at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1505)

如何解决?

我找到了理由,因为没有从SQLiteOpenHelper调用onUpgrade,我忘记在新版本中更改DATABASE_VERSION

0 个答案:

没有答案