column context_id is not unique (code 19)

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

  • via by Unknown author, 10 months ago
    column context_id is not unique (code 19)
  • via GitHub by mrkam
    , 1 year ago
    column context_id is not unique (code 19)
  • column context_id is not unique (code 19)
  • Stack trace

    • android.database.sqlite.SQLiteConstraintException: column context_id is not unique (code 19) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId( at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId( at android.database.sqlite.SQLiteStatement.executeInsert( at android.database.sqlite.SQLiteDatabase.insertWithOnConflict( at android.database.sqlite.SQLiteDatabase.insert( at at at at at at at at android.os.Handler.dispatchMessage( at android.os.Looper.loop( at

    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
    124 times, 1 year ago
    3 times, 1 year ago
    6 times, 1 year ago
    358 times, 1 year ago
    68 more bugmates