android.database.sqlite.SQLiteConstraintException

tip

activity.OnCreate is executed every time the app launches or the screen is rotated, so, putting your DB initialization inside it will cause the DB to be called too many times causing the exception. Try to use the MyDatabase.onCreate method for this.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • GitHub comment 87#253164477
    via GitHub by Mygod
    ,
  • Android database method was called twice
    via Stack Overflow by user4901016
    ,
  • Errors when running
    via Stack Overflow by Alexia White
    ,
  • Android Xml data parsing
    via Stack Overflow by hashim
    ,
  • sending attachment failed
    via GitHub by Safari77
    ,
    • android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: jobs._id (code 1555) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782) at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788) at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1472) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1343) at com.evernote.android.job.JobStorage.store(JobStorage.java:192) at com.evernote.android.job.JobStorage.put(JobStorage.java:109) at com.evernote.android.job.JobManager.schedule(JobManager.java:231) at com.evernote.android.job.JobRequest.schedule(JobRequest.java:320) at com.evernote.android.job.JobRequest.reschedule(JobRequest.java:351) at com.evernote.android.job.JobExecutor$JobCallable.handleResult(JobExecutor.java:166) at com.evernote.android.job.JobExecutor$JobCallable.runJob(JobExecutor.java:153) at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:135) at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:118) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

    Users with the same issue

    tererecooltererecool
    24 times, last one,
    filipebatistafilipebatista
    1 times, last one,
    Unknown UserUnknown User
    1 times, last one,
    Hiren AmaliyarHiren Amaliyar
    1 times, last one,
    Indri YunitaIndri Yunita
    20 times, last one,
    68 more bugmates