新的 Jetpack 分页库使应用程序崩溃 - 新

New Jetpack paging library makes app crash - NEW

我更新了以下库:

 - kotlin.reflect to 1.5.31
 - room.paging to 2.4.0-alpha05
 - room.ktx to 2.4.0-alpha05

现在,我的应用程序的所有功能都使用了带 Flow 和 Paging 的 Room 对象列表(实际上是我所有的 RecyclerViews)崩溃,并出现以下模糊的异常:

java.lang.AbstractMethodError: abstract method "java.lang.Object androidx.paging.PagingDataDiffer.presentNewList(androidx.paging.NullPaddedList, androidx.paging.NullPaddedList, int, kotlin.jvm.functions.Function0, kotlin.coroutines.Continuation)"
    at androidx.paging.PagingDataDiffer$collectFrom.invokeSuspend(PagingDataDiffer.kt:151)
    at androidx.paging.PagingDataDiffer$collectFrom.invoke(Unknown Source:8)
    at androidx.paging.PagingDataDiffer$collectFrom.invoke(Unknown Source:4)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
    at androidx.paging.PagingDataDiffer$collectFrom$invokeSuspend$$inlined$collect.emit(Collect.kt:135)
    at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62)
    at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl(Channels.kt:1)
    at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl.invokeSuspend(Unknown Source:14)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
    at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:244)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:398)
    at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:514)
    at kotlinx.coroutines.channels.AbstractChannel$ReceiveElement.completeResumeReceive(AbstractChannel.kt:907)
    at kotlinx.coroutines.channels.ArrayChannel.offerInternal(ArrayChannel.kt:83)
    at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:134)
    at androidx.paging.PageFetcherSnapshot.doInitialLoad(PageFetcherSnapshot.kt:318)
    at androidx.paging.PageFetcherSnapshot.access$doInitialLoad(PageFetcherSnapshot.kt:55)
    at androidx.paging.PageFetcherSnapshot$doInitialLoad.invokeSuspend(Unknown Source:14)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8512)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

如果我恢复以前版本的库,一切都会再次正常工作。请帮忙!

注意:

不要将此问题绑定到以下问题: 因为这个问题的答案甚至与这个问题无关,因为 Compose 包没有被使用,甚至没有包含在我的项目中,而且它不起作用(我测试过)。

使用 Paging 3.1.0-beta01 修复,或将 Room 恢复到稳定版 2.3.0。

Paging 库似乎破坏了 3.0.x 和 3.1.0 之间的二进制兼容性,而 Room 2.4.0-alpha05+ 正在使用更新后的合约。

这很可能与新的 room-paging 库有关。他们在发行说明中谈论了很多关于新的分页互操作要求,但我没有看到任何要求严格的版本要求。 https://developer.android.com/jetpack/androidx/releases/room#2.4.0-beta01