android.database.sqlite.SQLiteConstraintException

UNIQUE constraint failed: station._id (code 1555)

Samebug tips1

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.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web305

  • UNIQUE constraint failed: station._id (code 1555)
  • via GitHub by DvTonder
    , 2 months ago
    UNIQUE constraint failed: jobs._id (code 1555)
  • via GitHub by Mygod
    , 9 months ago
    UNIQUE constraint failed: jobs._id (code 1555)
  • Stack trace

    • android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: station._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:1471) at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1367) at com.vlille.checker.db.StationEntityManager.create(StationEntityManager.java:42) at com.vlille.checker.db.StationEntityManager.create(StationEntityManager.java:15) at org.droidparts.persist.sql.AbstractEntityManager$1.call(AbstractEntityManager.java:111) at org.droidparts.persist.sql.AbstractEntityManager$1.call(AbstractEntityManager.java:102) at org.droidparts.inner.PersistUtils.executeInTransaction(PersistUtils.java:155) at org.droidparts.persist.sql.AbstractEntityManager.executeInTransaction(AbstractEntityManager.java:148) at org.droidparts.persist.sql.AbstractEntityManager.cud(AbstractEntityManager.java:127) at org.droidparts.persist.sql.AbstractEntityManager.create(AbstractEntityManager.java:90) at com.vlille.checker.db.DBUpdater.update(DBUpdater.java:33) at com.vlille.checker.ui.async.DBUpdaterAsyncTask.doInBackground(DBUpdaterAsyncTask.java:32) at com.vlille.checker.ui.async.DBUpdaterAsyncTask.doInBackground(DBUpdaterAsyncTask.java:12) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) 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)

    Write tip

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

    Users with the same issue

    Unknown user
    Once, 1 year ago
    2 times, 1 year ago
    24 times, 2 weeks ago
    5 times, 2 weeks ago
    Once, 1 month ago
    68 more bugmates