0

When using paging3 with PagingSource, I meet the error code like this:

Class 'androidx.paging.PagingSource$LoadParams$Refresh' does not implement interface 'kotlin.coroutines.Continuation' in call to 'kotlin.coroutines.CoroutineContext kotlin.coroutines.Continuation.getContext()' (declaration of 'kotlin.coroutines.jvm.internal.ContinuationImpl' appears in /data/app/pnkj.android.module_article-1/base.apk:classes3.dex)

I don't know how to find the root of error, maybe this is the bug of paging3?

Here is the full error messages.

 java.lang.IncompatibleClassChangeError: Class 'androidx.paging.PagingSource$LoadParams$Refresh' does not implement interface 'kotlin.coroutines.Continuation' in call to 'kotlin.coroutines.CoroutineContext kotlin.coroutines.Continuation.getContext()' (declaration of 'kotlin.coroutines.jvm.internal.ContinuationImpl' appears in /data/app/pnkj.android.module_article-1/base.apk:classes3.dex)
    at kotlin.coroutines.jvm.internal.ContinuationImpl.<init>(ContinuationImpl.kt:102)
    at pnkj.android.module_article.mediator.ArticleZhuanTiAndCommentPagingSource$load$1.<init>(ArticleZhuanTiAndCommentPagingSource.kt)
    at pnkj.android.module_article.mediator.ArticleZhuanTiAndCommentPagingSource.load(ArticleZhuanTiAndCommentPagingSource.kt)
    at androidx.paging.PageFetcherSnapshot.doInitialLoad(PageFetcherSnapshot.kt:281)
    at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invokeSuspend(PageFetcherSnapshot.kt:157)
    at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invoke(PageFetcherSnapshot.kt)
    at androidx.paging.CancelableChannelFlowKt$cancelableChannelFlow$1.invokeSuspend(CancelableChannelFlow.kt:30)
    at androidx.paging.CancelableChannelFlowKt$cancelableChannelFlow$1.invoke(CancelableChannelFlow.kt)
    at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1$1.invokeSuspend(SimpleChannelFlow.kt:57)
    at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1$1.invoke(SimpleChannelFlow.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
    at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:194)
    at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1.invokeSuspend(SimpleChannelFlow.kt:52)
    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:236)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:362)
    at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:479)
    at kotlinx.coroutines.channels.AbstractChannel$ReceiveElement.completeResumeReceive(AbstractChannel.kt:899)
    at kotlinx.coroutines.channels.AbstractSendChannel.offerInternal(AbstractChannel.kt:56)
    at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:135)
    at androidx.paging.multicast.StoreRealActor.send(StoreRealActor.kt:69)
    at androidx.paging.multicast.ChannelManager.addDownstream(ChannelManager.kt:62)
    at androidx.paging.multicast.Multicaster$flow$1$subFlow$1.invokeSuspend(Multicaster.kt:78)
    at androidx.paging.multicast.Multicaster$flow$1$subFlow$1.invoke(Multicaster.kt)
    at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116)
    at androidx.paging.multicast.Multicaster$flow$1$invokeSuspend$$inlined$transform$1.invokeSuspend(Emitters.kt:215)
    at androidx.paging.multicast.Multicaster$flow$1$invokeSuspend$$inlined$transform$1.invoke(Emitters.kt)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
    at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
    at androidx.paging.multicast.Multicaster$flow$1.invokeSuspend(Multicaster.kt:100)
    at androidx.paging.multicast.Multicaster$flow$1.invoke(Multicaster.kt)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
    at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(Errors.kt:230)
    at kotlinx.coroutines.flow.FlowKt.catchImpl(Unknown Source)
    at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113)
    at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
    at androidx.paging.CachedPageEventFlow$downstreamFlow$1$activeStreamCollection$1.invokeSuspend(CachedPageEventFlow.kt:292)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at androidx.lifecycle.DispatchQueue.drainQueue(DispatchQueue.kt:76)
    at androidx.lifecycle.DispatchQueue.resume(DispatchQueue.kt:55)
    at androidx.lifecycle.LifecycleController$observer$1.onStateChanged(LifecycleController.kt:40)
    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361)
    at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:300)
    at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:339)
    at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145)
    at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131)
    at androidx.fragment.app.Fragment.performStart(Fragment.java:2736)
    at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:365)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1206)
    at androidx.fragment.app.FragmentManager.addAddedFragments(FragmentManager.java:2236)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2009)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1965)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861)
    at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:159)
    at android.app.ActivityThread.main(ActivityThread.java:6364)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
pnkj
  • 406
  • 5
  • 17
  • Are you transitively upgrading Paging in a binary incompatible way? What's the output of ./gradlew dependencies and what do your build.gradle files look like? – dlam Feb 26 '21 at 01:24
  • I find this bug.Because I return **Page(**,**,null) or Page(**,**,val) **.The nextKey is the key for this error. – pnkj Feb 27 '21 at 17:45
  • Can you share a sample reproducing this error? I'd file a bug here with your sample: https://issuetracker.google.com/issues/new?component=413106&template=1096385 – dlam Feb 28 '21 at 21:55
  • I have solve this bug just as I describe above – pnkj Mar 02 '21 at 00:01

0 Answers0