FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

The latest version 8.0.1 crashes the app with IllegalStateException (whereas 8.0.0 works completely fine)

Open vedprakashwagh opened this issue 3 years ago • 8 comments

Environment

  • Android device: Android Emulator
  • Android OS version: Android 12
  • Google Play Services version: -
  • Firebase/Play Services SDK version: 28.4.2 (Firebase BOM)
  • FirebaseUI version: 8.0.1

Problem:

Steps to reproduce:

Scrolling through FirestorePagingAdapter will crash the app after first or second fetch.

Observed Results:

App crashes with following error.

java.lang.IllegalStateException: The same value, PageKey{StartAfter=KEY_ID_HERE, EndBefore=null}, was passed as the nextKey in two
     sequential Pages loaded from a PagingSource. Re-using load keys in
     PagingSource is often an error, and must be explicitly enabled by
     overriding PagingSource.keyReuseSupported.
        at androidx.paging.PageFetcherSnapshot.doLoad(PageFetcherSnapshot.kt:419)
        at androidx.paging.PageFetcherSnapshot.access$doLoad(PageFetcherSnapshot.kt:54)
        at androidx.paging.PageFetcherSnapshot$doLoad$1.invokeSuspend(Unknown Source:15)
        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:7839)
        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)

Expected Results:

Load the next set of data

Relevant Code:

It works perfectly fine with FirebaseUI version 8.0.0, but upgrading to 8.0.1 crashes the app with following error.

vedprakashwagh avatar May 28 '22 19:05 vedprakashwagh

the same error occured

maratkarelov avatar Jun 11 '22 14:06 maratkarelov

I posted this a month ago, but no answers yet

https://stackoverflow.com/questions/71961407/firestorepagingadapter-crashes-when-scrolling-in-version-8-0-1

LastSocialDroid2 avatar Jun 11 '22 23:06 LastSocialDroid2

Internal bug filed at b/235862945

shrutip90 avatar Jun 13 '22 20:06 shrutip90

Thanks for filing this @vedprakashwagh ! I'll have a look at it. ( looks like a duplicate of #2000 )

Edit: this is not a duplicate because it refers to Firestore, while the other issue refers to the Realtime Database.

thatfiredev avatar Jun 14 '22 09:06 thatfiredev

@vedprakashwagh Can you please also share the full Query that you passed to your FirebaseRecyclerPagingAdapter?

thatfiredev avatar Jun 14 '22 09:06 thatfiredev

@thatfiredev I'm getting the same error with this Query:

Query query = notebookRef.orderBy("timestampSort", Query.Direction.ASCENDING);

LastSocialDroid2 avatar Jun 14 '22 12:06 LastSocialDroid2

@thatfiredev Hey! Yes, here's the query.

query = Firebase.firestore.collection("collectionName") .orderBy("keyOfTimestamp", Query.Direction.DESCENDING)

vedprakashwagh avatar Jun 14 '22 12:06 vedprakashwagh

After two days of debugging my code, I also figured that version 8.0.0 still works where 8.0.1 crashes on the first paging load (not initial). Query also is of the sort Firebase.firestore.collection("collectionName") .orderBy("keyOfTimestamp", Query.Direction.DESCENDING)

dhoehl avatar Jul 10 '22 19:07 dhoehl

This issue should be solved in version 8.0.2

thatfiredev avatar Sep 28 '22 12:09 thatfiredev