使用GreenDao出現:unique constraint failed解

集成GreenDao,inserty一個Entity會出現greendao unique constraint failed錯誤.

1.首先entity中需要存在一個Long類型的主鍵(@Id(autoincrement = true) private long id;)

2.在entity的構造方法中置id = null.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章