微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Paging3不确定如何转换PagingSource

如何解决Paging3不确定如何转换PagingSource

这是实际错误

C:\Users\Michal\AndroidStudioProjects\swibbidandroidkotlin\app\build\tmp\kapt3\stubs\debug\dk\swibbid\mz\data\model\ProductDao.java:28: error: Not sure how to convert a Cursor to this method's return type (androidx.paging.PagingSource<java.lang.Integer,dk.swibbid.mz.data.model.Product>).
public abstract java.lang.Object getAllProductsPagination(@org.jetbrains.annotations.NotNull()
warning: File for type 'dk.swibbid.mz.SwibbidApplication_HiltComponents' created in the last round 
will not be subject to annotation processing.
> Task :app:kaptDebugKotlin Failed

不应出现此错误,因为因为我有正确的依赖关系,但仍然存在:

implementation "androidx.room:room-runtime:2.3.0-alpha03"
kapt "androidx.room:room-compiler:2.3.0-alpha03"
implementation "androidx.room:room-ktx:2.3.0-alpha03"
implementation "androidx.paging:paging-runtime:3.0.0-alpha07"

我尝试使用所有旧的依赖项,但仍然存在相同的错误。我尝试清理构建并重建项目。

我已经看过这篇文章

Paging3: "Not sure how to convert a Cursor to this method's return type" when using PagingSource as return type in Room DAO

解决方法

好,我解决了这个问题,Dao函数不能是挂起函数...

希望错误告诉我,

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。