Status Update
Comments
ar...@google.com <ar...@google.com> #2
Hi,
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
kk...@linkedin.com <kk...@linkedin.com> #3
Thought I should mention for posterity, a temporary workaround is:
mStaggeredGridLayoutManager.setItemPrefetchEnabled(false);
mStaggeredGridLayoutManager.setItemPrefetchEnabled(false);
kk...@linkedin.com <kk...@linkedin.com> #4
[Comment deleted]
ar...@google.com <ar...@google.com> #5
The bug is reproduced on physical device.
1. RecyclerView with GridLayoutManager (3 column)
2. All items has span = 3 (grid look like simple list)
3. Scrolling up and down is working fine
4. Insert items in the middle of the list (All inserted items has span 3 too)
5. call to notifyDataChanged()
6. Grid is expanded with animation
6. Scrolling up and down is failed.
Problem is found after adding android:animateLayoutChanges="true" into a parent layout.
Bug reproducing is stable.
1. RecyclerView with GridLayoutManager (3 column)
2. All items has span = 3 (grid look like simple list)
3. Scrolling up and down is working fine
4. Insert items in the middle of the list (All inserted items has span 3 too)
5. call to notifyDataChanged()
6. Grid is expanded with animation
6. Scrolling up and down is failed.
Problem is found after adding android:animateLayoutChanges="true" into a parent layout.
Bug reproducing is stable.
ch...@google.com <ch...@google.com> #6
Bug reproduced id add "android:animateLayoutChanges="true" to list item layout:
RecycleView
--Root Item view layout is: RelativeLayout
----LinearLayout
--------ViewPager
----------Page0: is <LinearLayout... "android:animateLayoutChanges="true".../> <-- this attr is the bug reason
RecycleView
--Root Item view layout is: RelativeLayout
----LinearLayout
--------ViewPager
----------Page0: is <LinearLayout... "android:animateLayoutChanges="true".../> <-- this attr is the bug reason
xa...@google.com <xa...@google.com>
be...@google.com <be...@google.com> #7
You cannot use android:animateLayoutChanges with RecyclerView.
It will try to animate children of the RecyclerView and conflict with the ItemAnimator.
You can still use TransitionManager directly (which that attribute uses) but make sure to exclude RecyclerView's children.
It will try to animate children of the RecyclerView and conflict with the ItemAnimator.
You can still use TransitionManager directly (which that attribute uses) but make sure to exclude RecyclerView's children.
dh...@linkedin.com <dh...@linkedin.com> #8
Hi, original reporter here. I did not use animateLayoutChanges. See example project in original report.
be...@google.com <be...@google.com> #9
sorry for the confusion, i've re-opened the ticket.
ji...@gmail.com <ji...@gmail.com> #10
I face same problem , no solution till now ?
kk...@linkedin.com <kk...@linkedin.com> #11
it is fixed internally, so in the next release it should be fine.
zt...@google.com <zt...@google.com> #12
public class MyStaggerLayoutManager extends StaggeredGridLayoutManager {
public MyStaggerLayoutManager(int spanCount, int orientation) {
super(spanCount, orientation);
}
public MyStaggerLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void collectAdjacentPrefetchPositions(int dx, int dy, RecyclerView.State state, LayoutPrefetchRegistry layoutPrefetchRegistry) {
try {
super.collectAdjacentPrefetchPositions(dx, dy, state, layoutPrefetchRegistry);
} catch (IllegalArgumentException e) {
LogUtils.e("catch IllegalArgumentException");
}
}
}
i fixed it by using custom LayoutManager
public MyStaggerLayoutManager(int spanCount, int orientation) {
super(spanCount, orientation);
}
public MyStaggerLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void collectAdjacentPrefetchPositions(int dx, int dy, RecyclerView.State state, LayoutPrefetchRegistry layoutPrefetchRegistry) {
try {
super.collectAdjacentPrefetchPositions(dx, dy, state, layoutPrefetchRegistry);
} catch (IllegalArgumentException e) {
LogUtils.e("catch IllegalArgumentException");
}
}
}
i fixed it by using custom LayoutManager
ji...@gmail.com <ji...@gmail.com> #13
We have the same problem with version 25.1.0 and made the decision to go back to 25.0.1
je...@gmail.com <je...@gmail.com> #14
Issue has been fixed and released in 25.1.1 support lib
je...@gmail.com <je...@gmail.com> #15
Version 25.1.1 doesn't seem to solve the issue for me.
My use case could be a little different (maybe easier) from OP's.
1. StaggeredGridLayoutManager with multiple columns (eg. 2)
2. Single item view type - ImageView wrapped in CardView (both layout_width="match_parent", layout_height="wrap_content", ImageView:adjustViewBounds="true")
3. Load 1,000 items, performs image loading with Glide (All images stored on device storage)
4. Flinging the list up and down.
Same exception will be thrown randomly.
PS: As OP suggested, I do StaggeredGridLayoutManager.setItemPrefetchEnabled(false); to prevent the issue from happening.
My use case could be a little different (maybe easier) from OP's.
1. StaggeredGridLayoutManager with multiple columns (eg. 2)
2. Single item view type - ImageView wrapped in CardView (both layout_width="match_parent", layout_height="wrap_content", ImageView:adjustViewBounds="true")
3. Load 1,000 items, performs image loading with Glide (All images stored on device storage)
4. Flinging the list up and down.
Same exception will be thrown randomly.
PS: As OP suggested, I do StaggeredGridLayoutManager.setItemPrefetchEnabled(false); to prevent the issue from happening.
zt...@google.com <zt...@google.com> #16
We still have the problem with 25.1.1 using RecyclerView
java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110) at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202) at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110) at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202) at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
dn...@google.com <dn...@google.com> #17
Reopening to investigate repros in 25.1.1
ra...@flipkart.com <ra...@flipkart.com> #18
Another report: we got the same thing on support library 25.1.1
Here is the crash log:
Fatal Exception: java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.GridLayoutManager.collectPrefetchPositionsForLayoutState(GridLayoutManager.java:514)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5237)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Here is the crash log:
Fatal Exception: java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.GridLayoutManager.collectPrefetchPositionsForLayoutState(GridLayoutManager.java:514)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5237)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
ma...@gmail.com <ma...@gmail.com> #19
#19 and #21 are slightly different from the original issue, since they're from LinearLayoutManager and GridLayoutManager. I see how this may be occurring, and will put in a fix.
As to the case in #18, I'm not sure how StaggeredGridLayoutManager could have these issues in 25.1.1, looking at the code (and scrolling around manually in a 2 column staggered grid), I'm not seeing the issue. Are you sure you're both on 25.1.1, and seeing StaggeredGridLayoutManager in the stack trace?
As to the case in #18, I'm not sure how StaggeredGridLayoutManager could have these issues in 25.1.1, looking at the code (and scrolling around manually in a 2 column staggered grid), I'm not seeing the issue. Are you sure you're both on 25.1.1, and seeing StaggeredGridLayoutManager in the stack trace?
[Deleted User] <[Deleted User]> #20
Getting the same stacktrace with RecyclerView for support library 25.1.1
Fatal Exception: java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Fatal Exception: java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
[Deleted User] <[Deleted User]> #21
[Comment deleted]
on...@gmail.com <on...@gmail.com> #22
I have the same crash using support lib 25.2.0. Is there a different issue to track this crash from a LinearLayoutManager, looks like it was opened for the StaggeredGridLayoutManager
Pixel distance must be non-negative
java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Pixel distance must be non-negative
java.lang.IllegalArgumentException: Pixel distance must be non-negative
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.addPosition(GapWorker.java:110)
at android.support.v7.widget.LinearLayoutManager.collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:1202)
at android.support.v7.widget.LinearLayoutManager.collectAdjacentPrefetchPositions(LinearLayoutManager.java:1300)
at android.support.v7.widget.GapWorker$LayoutPrefetchRegistryImpl.collectPrefetchPositionsFromView(GapWorker.java:94)
at android.support.v7.widget.GapWorker.buildTaskList(GapWorker.java:213)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:343)
at android.support.v7.widget.GapWorker.run(GapWorker.java:370)
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:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
be...@google.com <be...@google.com>
ti...@google.com <ti...@google.com> #23
got the same crash with 25.1.1 annd 25.2.0.
here you can find the demo project to reproduce this issue:https://github.com/longerian/VlayoutDemo
here you can find the demo project to reproduce this issue:
Description
Here is an example StackTrace:
android.view.InflateException: Binary XML file line #57: Error inflating class android.support.design.widget.TextInputLayout at android.view.LayoutInflater.createView(LayoutInflater.java:633) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:916) at android.view.LayoutInflater.rInflate(LayoutInflater.java:802) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at com.linkedin.android.infra.app.LayoutTestActivity$1.run(LayoutTestActivity.java:92) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607)
... 19 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/design_password_eye.xml from drawable resource ID #0x7f0200fe at android.content.res.Resources.loadDrawableForCookie(Resources.java:2479) at android.content.res.Resources.loadDrawable(Resources.java:2381) at android.content.res.Resources.getDrawable(Resources.java:787) at android.content.Context.getDrawable(Context.java:403) at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:30) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:372) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:202) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190) at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100) at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:71) at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:239) at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:183)
... 22 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-anydpi-v21/avd_show_password.xml from drawable resource ID #0x7f0200c6 at android.content.res.Resources.loadDrawableForCookie(Resources.java:2479) at android.content.res.Resources.loadDrawable(Resources.java:2381) at android.content.res.TypedArray.getDrawable(TypedArray.java:749) at android.graphics.drawable.AnimatedStateListDrawable.parseTransition(AnimatedStateListDrawable.java:472) at android.graphics.drawable.AnimatedStateListDrawable.inflateChildElements(AnimatedStateListDrawable.java:454) at android.graphics.drawable.AnimatedStateListDrawable.inflate(AnimatedStateListDrawable.java:384) at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032) at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
... 33 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-anydpi-v21/avd_show_password_1.xml from drawable resource ID #0x7f0205e6 at android.content.res.Resources.loadDrawableForCookie(Resources.java:2479) at android.content.res.Resources.loadDrawable(Resources.java:2381) at android.content.res.Resources.getDrawable(Resources.java:787) at android.graphics.drawable.AnimatedVectorDrawable.inflate(AnimatedVectorDrawable.java:286) at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032) at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
... 41 more
Caused by: java.lang.RuntimeException: error in parsing "‮"
at android.util.PathParser.getFloats(PathParser.java:200) at android.util.PathParser.createNodesFromPathData(PathParser.java:63) at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1436) at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1418) at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:544) at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:460) at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032) at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
... 47 more
Caused by: java.lang.NumberFormatException: Invalid float: "‮"
at java.lang.StringToReal.invalidReal(StringToReal.java:63) at java.lang.StringToReal.initialParse(StringToReal.java:164) at java.lang.StringToReal.parseFloat(StringToReal.java:323) at java.lang.Float.parseFloat(Float.java:306) at android.util.PathParser.getFloats(PathParser.java:187) ... 55 more