Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set 'scaleX' to Float.NaN #160

Open
iovorobiev opened this issue Jan 23, 2019 · 6 comments
Open

Cannot set 'scaleX' to Float.NaN #160

iovorobiev opened this issue Jan 23, 2019 · 6 comments
Labels
can't reproduce Include please a sample project where I can reproduce the issue.

Comments

@iovorobiev
Copy link

Getting a lot of these crashes on Android 9 devices only. Any ideas what can it be?

Fatal Exception: java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN
       at android.view.View.sanitizeFloatPropertyValue(View.java:15582)
       at android.view.View.sanitizeFloatPropertyValue(View.java:15556)
       at android.view.View.setScaleX(View.java:14945)
       at com.yarolegovich.discretescrollview.transform.ScaleTransformer.transformItem(ScaleTransformer.java:29)
       at com.yarolegovich.discretescrollview.DiscreteScrollLayoutManager.applyItemTransformToChildren(DiscreteScrollLayoutManager.java:342)
       at com.yarolegovich.discretescrollview.DiscreteScrollLayoutManager.onLayoutChildren(DiscreteScrollLayoutManager.java:123)
       at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
       at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1638)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:726)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:823)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2941)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1740)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2028)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1624)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7926)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1079)
       at android.view.Choreographer.doCallbacks(Choreographer.java:885)
       at android.view.Choreographer.doFrame(Choreographer.java:809)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1065)
       at android.os.Handler.handleCallback(Handler.java:891)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:207)
       at android.app.ActivityThread.main(ActivityThread.java:7470)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
@sanisloandras
Copy link

Getting the same ecxeption.
Probably because of my item layout xml.
`
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:layout_width="@dimen/image_size"
tools:layout_height="@dimen/image_size"
android:id="@+id/root">

<ImageView
        android:id="@+id/iv_image"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:scaleType="centerCrop"
        tools:src="@tools:sample/backgrounds/scenic"
        app:layout_constraintDimensionRatio="w,1:1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
</ImageView>

</androidx.constraintlayout.widget.ConstraintLayout>`

@cyw026
Copy link

cyw026 commented Oct 23, 2019

Getting the same ecxeption

@KollerWithDoris
Copy link

Getting a lot of these crashes on Android 9 devices only. Any ideas what can it be?

Fatal Exception: java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN
       at android.view.View.sanitizeFloatPropertyValue(View.java:15582)
       at android.view.View.sanitizeFloatPropertyValue(View.java:15556)
       at android.view.View.setScaleX(View.java:14945)
       at com.yarolegovich.discretescrollview.transform.ScaleTransformer.transformItem(ScaleTransformer.java:29)
       at com.yarolegovich.discretescrollview.DiscreteScrollLayoutManager.applyItemTransformToChildren(DiscreteScrollLayoutManager.java:342)
       at com.yarolegovich.discretescrollview.DiscreteScrollLayoutManager.onLayoutChildren(DiscreteScrollLayoutManager.java:123)
       at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
       at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1638)
       at android.view.View.measure(View.java:23480)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:726)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6831)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:823)
       at android.view.View.measure(View.java:23480)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2941)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1740)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2028)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1624)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7926)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1079)
       at android.view.Choreographer.doCallbacks(Choreographer.java:885)
       at android.view.Choreographer.doFrame(Choreographer.java:809)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1065)
       at android.os.Handler.handleCallback(Handler.java:891)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:207)
       at android.app.ActivityThread.main(ActivityThread.java:7470)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

check your layout.xml width and height is 0 or not.

maybe you use the :
android:layout_height="0dp" or
android:layout_width="0dp" or
android:visible="gone"

every of them will make your rootView become error size.

so it's will throw that exception

@anatamar
Copy link

anatamar commented Jun 1, 2020

Is there any update on this crash? We have the same issue

@yarolegovich yarolegovich added bug can't reproduce Include please a sample project where I can reproduce the issue. and removed bug labels Jul 30, 2020
@yarolegovich
Copy link
Owner

Maybe related to #194

@RobDaytona
Copy link

RobDaytona commented Sep 12, 2020

Hmm, this seems to me like a new bug in a recent android release (possibly the update yesterday)
This is a basic call in Xamarin Forms
element.RelScaleTo(elementScale, millisecondsDelay); where elementScale is a double, and millisecondsDelay a unsigned int.
This call has worked previously but breaks now with the error message in this thread.
-Update on this one, I was passing in 0 to the millisecondsDelay, because I wanted to change the scale of the elelment after it had been rendered, instantaneously.. seems 0 is not a number in this case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't reproduce Include please a sample project where I can reproduce the issue.
Projects
None yet
Development

No branches or pull requests

7 participants