Paging3不确定如何转换PagingSource

时间:2020-10-21 13:28:11

标签: android kotlin android-room android-paging

这是实际错误

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

1 个答案:

答案 0 :(得分:0)

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

希望错误告诉我,