android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: NewMessage.type (code 1555)

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
Expert 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.

Solutions on the web

via GitHub by dwaynehoy
, 1 year ago
UNIQUE constraint failed: PointOfInterest._id (code 1555)
via Stack Overflow by Giordano
, 2 years ago
via Stack Overflow by Unknown author, 2 years ago
column NAME is not unique (code 19)
via Stack Overflow by John
, 1 year ago
UNIQUE constraint failed: PictureInfos.idPicture (code 1555)
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: NewMessage.type (code 1555)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:952)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
at com.raizlabs.android.dbflow.structure.database.AndroidDatabaseStatement.executeInsert(AndroidDatabaseStatement.java:77)
at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.insert(ModelSaver.java:110)
at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save(ModelSaver.java:57)
at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save(ModelSaver.java:40)
at com.raizlabs.android.dbflow.structure.ModelAdapter.save(ModelAdapter.java:103)
at com.raizlabs.android.dbflow.structure.BaseModel.save(BaseModel.java:51)
at co.runner.app.util.MessageManager$4.run(MessageManager.java:198)
at co.runner.app.utils.ThreadManager$SafeRunnable.run(ThreadManager.java:46)
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)

Users with the same issue

4 times, 11 months ago
Once, 5 months ago
617 times, 1 year ago
Once, 1 year ago
3 times, 1 year ago
72 more bugmates

Know the solutions? Share your knowledge to help other developers to debug faster.