android - 为什么 Android 12 和房间寻呼现在会崩溃

标签 android android-room

我已更新我的 Android 应用程序以面向 Android S,并被迫添加

api 'androidx.room:room-paging:2.4.0-beta01'

到我的 gradle 构建文件。

现在我的应用程序崩溃了

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.elsevier.funding.institutional, PID: 16031
    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$2$1$1.invokeSuspend(PagingDataDiffer.kt:151)
        at androidx.paging.PagingDataDiffer$collectFrom$2$1$1.invoke(Unknown Source:8)
        at androidx.paging.PagingDataDiffer$collectFrom$2$1$1.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$2$invokeSuspend$$inlined$collect$1.emit(Collect.kt:135)
        at androidx.paging.PagingDataTransforms$map$$inlined$transform$1$2.emit(Collect.kt:138)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.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:397)
        at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:513)
        at kotlinx.coroutines.channels.AbstractChannel$ReceiveElement.completeResumeReceive(AbstractChannel.kt:908)
        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:317)
        at androidx.paging.PageFetcherSnapshot.access$doInitialLoad(PageFetcherSnapshot.kt:54)
        at androidx.paging.PageFetcherSnapshot$doInitialLoad$1.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.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7842)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

我哪里出错了?

最佳答案

修复方法是将分页 androidx.paging:paging-runtime-ktx 增加到 beta01

api 'androidx.room:room-ktx:2.4.0-beta01'
api 'androidx.room:room-runtime:2.4.0-beta01'
api 'androidx.room:room-paging:2.4.0-beta01'
api 'androidx.paging:paging-runtime-ktx:3.1.0-beta01'
kapt 'androidx.room:room-compiler:2.4.0-beta01'

关于android - 为什么 Android 12 和房间寻呼现在会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69646809/

相关文章:

java - Room Insert 仅插入主键而不插入列

android - 链接在我的 HTML5 应用程序上无法正常工作

android - Volley 优先权无法正常工作

android - 从 Android 的强制门户浏览器 (CaptivePortalLogin) 启动默认浏览器

带有kotlin值类的android房间?

android - 房间数据库错误 : Migration didn't properly handle

java - 如何在 ListView 中创建工作复选框(其中包含来自 sqlite 数据库的项目)

android - 由 : android. util.AndroidRuntimeException 引起:在添加内容之前必须调用 requestFeature() android 异常

kotlin - 我怎么知道房间的@Insert 已完成?

android - SQL 删除 NOT IN 不起作用的地方