After updating FirebaseUi from implementation 'com.firebaseui:firebase-ui-firestore:8.0.0' to implementation 'com.firebaseui:firebase-ui-firestore:8.0.1' FirestorePagingAdapter crashes when I scroll the RecyclerView. I think it always crashes at the same position, maybe at this position it loads new items for the first time.
I get the following crashlog:
java.lang.IllegalStateException: The same value, PageKey{StartAfter=1MbZLsOSoWUPAdDnNOGlthxGjDC2 - 02:52:33 - 11.04.2022, 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.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8063)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Related
i have created a fragment to road some data but i want to load this fragment in n-number of containers which i want make this a dynamic like let say i have to load 10 fragments like this then in loop am creating a 10 number of frame layout and loading the fragment in it.
This is working fine but it is failing in the scenario where i moved to another come back to this fragment by pressing device back, there it is crashing and showing the below exception
java.lang.IllegalArgumentException: No view found for id 0x7f0b0c1e (:id/fragmentMy for fragment MyFragment{10b5860} (d681f0eb-720b-40e2-8240-9b45310a13b5 id=0x7f0b0c1e tag=My fragment 0)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:513)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
at android.os.Handler.handleCallback(Handler.java:942)
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:7898)
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:936)
does any one any idea how to fix this, BDW am using child fragment fragment while loading this fragments inside a fragment
i have loading the same stuff with static xml layout also but still facing the same exception
even i removing all the view inside a layout before loading new frames layouts
I'm getting this annoying exception in my main activity sometimes.
the stack trace is like this:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tomatedigital.lottogram, PID: 4430
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 543588 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4156)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: android.os.TransactionTooLargeException: data parcel size 543588 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:761)
at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:5147)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4148)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
The trace itself is not very helpfull since it doesn't specify which component or what transaction Id or Tag is related to the Exception (google please think about the debuggability of the crap you put out there)...
but i do suspect it is the recycleview i have in my main activity.
This recycleview might get super loaded, THOUSANDS of items. each of them contains: 3 small strings, 1 large string and one small bitmap.
When this recyclerview is overloaded and the activity is suspended this exception is thrown. Since the recyclerview is created inflating the layout.xml, android do save its state automaticly.
Is there any easy way to workaround this problem?
Is possible to set the App to allow "super large Transaction"?
What can i do?
================UPDATE===================
to provide aditional information about my Activity
#Override
protected void onSaveInstanceState(#NonNull Bundle outState) {
outState.putSerializable("media", this.media); //this is a domain class
outState.putBoolean("canceled", this.canceled);
outState.putInt("speed", this.speed);
outState.putLong("startTime", this.startTime);
outState.putSerializable("comments", (Serializable) this.adapter.getList()); //this is the large data
outState.putBoolean("commentLoadComplet", this.complete);
outState.putSerializable("fetched", (Serializable) this.fetched);
outState.putSerializable("igiboAttendees", (Serializable) this.igiboAttendees);
outState.putLong("winnerId", this.winnerId);
super.onSaveInstanceState(outState);
}
This is typically caused by saving large amounts of data in onSaveInstanceState, not only for the activity in which the exception occurred, but also in other activities currently in the back stack.
One solution is to use the ViewModel class to maintain state instead of onSaveInstanceState:
ViewModel Overview
You may still use onSaveInstanceState for small amounts of data, but keep in mind it adds up over all the activities.
I got a RecyclerView with an ItemTouchHelper implemented.
The app crashes when swiping an item and changing the current fragment in the same time (Yeah I got a crashlytics about that and could reproduce it).
The following crash exception is from ItemTouchHelper class.
The crash happens at this method postDispatchSwipe, the RecyclerView is null.
As the method is called after the swipe gesture, I'm wondering if there is something I can do from my side or fill an google issue.
If you guys have any idea... Thanks :)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView.post(java.lang.Runnable)' on a null object reference
at androidx.recyclerview.widget.ItemTouchHelper.postDispatchSwipe(ItemTouchHelper.java:700)
at androidx.recyclerview.widget.ItemTouchHelper$3.onAnimationEnd(ItemTouchHelper.java:653)
at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:552)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1232)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1474)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1063)
at android.view.Choreographer.doCallbacks(Choreographer.java:877)
at android.view.Choreographer.doFrame(Choreographer.java:805)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1051)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Preface
I want to implement a download animation in RecyclerView. In onBindViewHolder and onViewRecycled I subscribe to and unsubscribe from presenter which retrieves the percentage of already downloaded file.
I start animation:
AnimatedVectorDrawableCompat drawable = AnimatedVectorDrawableCompat.create(context, R.drawable.download_animated);
if (drawable != null) {
holder.downloadingIcon.setImageDrawable(drawable);
drawable.start();
}
Problem
I have got onViewRecycled invoked right after the animation is finished with follow stacktrace:
java.lang.RuntimeException
at EventRecyclerViewAdapter.onViewRecycled(EventRecyclerViewAdapter.java:271)
at android.support.v7.widget.RecyclerView$Recycler.dispatchViewRecycled(RecyclerView.java:6064)
at android.support.v7.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:5835)
at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:5800)
at android.support.v7.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1305)
at android.support.v7.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:11775)
at android.support.v7.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:12275)
at android.support.v7.widget.SimpleItemAnimator.dispatchChangeFinished(SimpleItemAnimator.java:304)
at android.support.v7.widget.DefaultItemAnimator$7.onAnimationEnd(DefaultItemAnimator.java:363)
at android.support.v4.view.ViewPropertyAnimatorCompatJB$1.onAnimationEnd(ViewPropertyAnimatorCompatJB.java:51)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1121)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1149)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1309)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.-wrap2(AnimationHandler.java)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:957)
at android.view.Choreographer.doCallbacks(Choreographer.java:734)
at android.view.Choreographer.doFrame(Choreographer.java:667)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:945)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Question
Why it behaves like so and how can I fix it?
It turns out, notifyItemChanged caused to recycler previous ViewHolder so onBindViewHolder and onViewRecycled are invoked... but on different instances. Firstly onBindViewHolder is invoked with new ViewHolder instance. Next onViewRecycled is invoked with the old ViewHolder. In my case problem was relying only on one id of the model. It doesn't unambiguously describe Presenter's View I used to notify about updates.
I have implemented the Endless scroll with RecyclerView. When user hit the bottom I'm adding null object to display progress in AsyncTask onPreExecute and notify adapter item Inserted. This code I have been using for quiet some time already. Recently I have updated android Support Library From 23.0.3 to 24.2.1. Since then I am getting exception when hit bottom of the list.
Cannot call this method in a scroll callback. Scroll callbacks might be run during a measure & layout pass where you cannot change the RecyclerView data. Any method call that might change the structure of the RecyclerView or the adapter contents should be postponed to the next frame.
java.lang.IllegalStateException:
at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2403)
at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeInserted(RecyclerView.java:4634)
at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeInserted(RecyclerView.java:10472)
at android.support.v7.widget.RecyclerView$Adapter.notifyItemInserted(RecyclerView.java:6214)
at com.test.film.buzz.BuzzFeedsFragment$5.onPreExecute(BuzzFeedsFragment.java:229)
at com.test.utils.ParallelAsyncTask.executeOnExecutor(ParallelAsyncTask.java:595)
at com.test.utils.ParallelAsyncTask.execute(ParallelAsyncTask.java:543)
at com.test.film.buzz.BuzzFeedsFragment.onLoadMore(BuzzFeedsFragment.java:258)
at com.test.film.buzz.BuzzFeedsFragment$3.onScrolled(BuzzFeedsFragment.java:177)
at android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:4305)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4463)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
at android.view.Choreographer.doCallbacks(Choreographer.java:683)
at android.view.Choreographer.doFrame(Choreographer.java:616)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)