【发布时间】:2022-01-07 10:21:55
【问题描述】:
我刚把kotlin从1.5更新到1.6,还有这个功能
@Query("SELECT * FROM Noticia")
suspend fun selectAll() :List<Noticia>
给我以下错误:
error: Not sure how to convert a Cursor to this method's return type (java.lang.Object).
public abstract java.lang.Object selectAll(@org.jetbrains.annotations.NotNull()
我猜是因为 kotlin 的新版本,但我不确定
【问题讨论】:
-
从定义中删除
suspend -
尝试清理项目,然后重建项目
-
我尝试了所有这些但没有奏效,当我从函数中删除暂停时给我这个错误:
java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
标签: android kotlin-coroutines android-studio-3.0