Open damien5314 opened 5 years ago
P.S. I can give this fix a try if you think that's a good approach 😄
Update: It seems this crash is specific to Android 9 devices 🤔
Sorry, one more update, but good news 😅 I figured out that this happens when triggering smooth scroll on a CardStackView that isn't actually visible (View.GONE
). This wasn't something we did intentionally, and so fixed it.
That said, the possibility of Float.NaN
in the setScaleX
call might be something we can guard against in this library. I'll let you decide if that makes sense 👍 If not, we can probably close this.
I'm having this issue as well
I met this error now. I using an old version 1.0.0-beta5. Is this error appear on latest version @damien5314 ?
The same issue facing with AndroidX Dependency,
java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN at android.view.View.sanitizeFloatPropertyValue(View.java:15446) at android.view.View.sanitizeFloatPropertyValue(View.java:15420) at android.view.View.setScaleX(View.java:14809) at com.yuyakaido.android.cardstackview.CardStackLayoutManager.updateScale(CardStackLayoutManager.java:433) at com.yuyakaido.android.cardstackview.CardStackLayoutManager.update(CardStackLayoutManager.java:348) at com.yuyakaido.android.cardstackview.CardStackLayoutManager.onLayoutChildren(CardStackLayoutManager.java:51) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4115) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3832) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4385) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656) at android.widget.LinearLayout.onLayout(LinearLayout.java:1565) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1801) at android.widget.LinearLayout.onLayout(LinearLayout.java:1567) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656) at android.widget.LinearLayout.onLayout(LinearLayout.java:1565) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656) at android.widget.LinearLayout.onLayout(LinearLayout.java:1565) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656) at android.widget.LinearLayout.onLayout(LinearLayout.java:1565) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656) at android.widget.LinearLayout.onLayout(LinearLayout.java:1565) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:757) at android.view.View.layout(View.java:20699) at android.view.ViewGroup.layout(ViewGroup.java:6198)
@yuyakaido any chance to look at this? I can make a pull request if needed.
@damien5314 I had something similar, was wrapping the size of CardStackView, that obviously wouldn't inflate anything and thus, will return 0 value dimensions.
Hi Guys,
I'm having the same issue when trying to press like or dislike button rapidly. This crash is causing a bad user experience for my application. Any suggestions regarding the fix?
Thanks in advance
Hi Guys,
I'm having the same issue when trying to press like or dislike button rapidly. This crash is causing a bad user experience for my application. Any suggestions regarding the fix?
Thanks in advance
You can try setting a definite layout_width
and layout_height
. Don't use wrap_content
. Fixed the issue in my case.
I have the same error
Try to use match_parent for the layout_width and layout_height of the card stack view.
Hi, sorry if this has been logged before, but I couldn't find it in search 😄 We're seeing crash reports with the following stack trace:
The integration with CardStackView & CardStackLayoutManager is not too complex:
I don't know if I can post the full layout for our ViewHolders, but based on the stacktrace it doesn't seem like anything in our layout would be causing this? Let me know if you think that would be helpful and I'll see what I can do 👍
The line causing the crash is here:
https://github.com/yuyakaido/CardStackView/blob/b1b6053b7d0649189a1443fded2d7df70e7e4527/cardstackview/src/main/java/com/yuyakaido/android/cardstackview/CardStackLayoutManager.java#L420
Somehow
targetScale
is being calculated toFloat.NaN
. It's not really clear to me how that's possible. Does it make sense to sanitize the value calculated before passing intosetScaleX
?