今天在學習android數據庫,運行程序的時候報錯,錯誤是:Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).Tried the following constructors but they failed to match:
Word(java.lang.String,java.lang.String) -> [param:english_word -> matched field:unmatched, param:chinese_meaning -> matched field:unmatched]。
解決方法:在實體類寫一個空的構造函數即可。
因為我有一個有參的構造函數,於是我寫了一個空的構造函數即可運行。
寫一個空的構造函數:
運行成功: