android.database.sqlite.SQLiteConstraintException: error code 19: constraint failedexception

后端 未结 2 824
自闭症患者
自闭症患者 2020-12-10 12:00

I created a table named resources but when I insert values in it, this exception is thrown:

android.database.sqlite.SQLiteConstraintException:
error         


        
相关标签:
2条回答
  • 2020-12-10 12:33

    In order to get more information about SQLite errors, one can use ADB dumpsys:

    adb shell dumpsys dbinfo -v
    

    combined with grep:

    adb shell dumpsys dbinfo -v | grep executeForLastInsertedRowId
    

    or grep'ed twice:

    adb shell dumpsys dbinfo -v | grep executeForChangedRowCount | grep failed
    
    0 讨论(0)
  • 2020-12-10 12:36

    Constraint failed usually indicates that you did something like pass a null value into a column that you declare as not null when you create your table.

    0 讨论(0)
提交回复
热议问题