Skip to content

InvalidObjectException: Remote key and the prevKey should not be null #93

@doilio

Description

@doilio

This error shows up the first time I run the completed codelab.

2020-07-26 16:25:41.483 29361-29361/com.example.android.codelabs.paging D/GithubRepository: New query: Android
2020-07-26 16:25:41.664 29361-29361/com.example.android.codelabs.paging D/GithubRemote: Current Page: 1 and LoadType = REFRESH
2020-07-26 16:26:25.761 29361-29361/com.example.android.codelabs.paging E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.android.codelabs.paging, PID: 29361
    java.io.InvalidObjectException: Remote key and the prevKey should not be null
        at com.example.android.codelabs.paging.data.GithubRemoteMediator.load(GithubRemoteMediator.kt:57)
        at androidx.paging.RemoteMediatorAccessor.doLoad(RemoteMediatorAccessor.kt:96)
        at androidx.paging.RemoteMediatorAccessor$doLoad$1.invokeSuspend(Unknown Source:16)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:175)
        at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:137)
        at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:108)
        at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:308)
        at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:318)
        at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:250)
        at kotlinx.coroutines.ResumeOnCompletion.invoke(JobSupport.kt:1394)
        at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1529)
        at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323)
        at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240)
        at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:903)
        at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:860)
        at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:825)
        at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:111)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

When I run again It works fine:

020-07-26 16:29:33.261 29558-29558/com.example.android.codelabs.paging D/GithubRepository: New query: Android
2020-07-26 16:29:33.471 29558-29558/com.example.android.codelabs.paging D/GithubRemote: Current Page: 1 and LoadType = REFRESH
2020-07-26 16:29:46.749 29558-29558/com.example.android.codelabs.paging D/GithubRemote: Current Page: 2 and LoadType = APPEND
2020-07-26 16:29:49.151 29558-29558/com.example.android.codelabs.paging D/GithubRemote: Current Page: 3 and LoadType = APPEND
2020-07-26 16:29:52.113 29558-29558/com.example.android.codelabs.paging D/GithubRemote: Current Page: 4 and LoadType = APPEND

If I uninstall and install it again. It shows me the same error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions