如何解决这个Android SQLite房间DAO错误消息?

如何解决这个Android SQLite房间DAO错误消息?,android,android-sqlite,android-room,dao,Android,Android Sqlite,Android Room,Dao,我不知道下面的问题出了什么问题 代码: 类别dao.kt @Dao interface CategoryDAO { @Query("select * from CategoryDesign") suspend fun getCategory(): MutableLiveData<List<CategoryDesign>> } 按Run App按钮将显示如下错误: error: Not sure how to convert a Cursor to t

我不知道下面的问题出了什么问题

代码:

类别dao.kt

@Dao
interface CategoryDAO {
    @Query("select * from CategoryDesign")
    suspend fun getCategory(): MutableLiveData<List<CategoryDesign>>


}
按Run App按钮将显示如下错误:

error: Not sure how to convert a Cursor to this method's return type (androidx.lifecycle.MutableLiveData<java.util.List<com.squall.searchdesigner.model.CategoryDesign>>).
    public abstract java.lang.Object getCategory(@org.jetbrains.annotations.NotNull()


w: [kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC), android.databinding.annotationprocessor.ProcessDataBinding (DYNAMIC).

似乎您只能使用返回类型。也许Room不允许您使用可变LiveData?

谢谢大家。 我使用了下面的代码,重建项目并使缓存失效似乎可以解决这个问题

@Dao
interface CategoryDAO {
    @Query("select * from CategoryDesign")
    fun getCategory(): LiveData<MutableList<CategoryDesign>>


}
@Dao
接口类别DAO{
@查询(“从类别设计中选择*)
fun getCategory():LiveData
}

你能添加你的
类别设计
实体吗?你在使用分页库吗?@Md.Asaduzzaman我已经添加了类别设计实体。@Raghundan我使用ViewPager和RecyclerView
dependencies {
    def room_version = "2.2.3"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
}
@Dao
interface CategoryDAO {
    @Query("select * from CategoryDesign")
    fun getCategory(): LiveData<MutableList<CategoryDesign>>


}