Ad

Material Floating Action Button Causing Error And Crashing Xml

I migrated to androidx and my dependencies are:

implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'com.google.android.material:material:1.1.0-alpha06'

I used FloatingActionButton :

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_margin="15dp"
    app:backgroundTint="@color/colorAccent"
    app:srcCompat="@drawable/ic_add_32dp"/>

But when I put FloatingActionButton, XML crashes(Render Problem). Even when I use the following :

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
   />

However, this error occurs only in XML and does not affect the execution of the program , and it does not show design mode for me. The problem with invalidate Cache and Restart is that it temporarily resolves the issue, but it happens again.

The Render Problem is:

java.lang.IllegalArgumentException: [email protected]   at java.lang.reflect.Method.invoke(Method.java:498)   at android.animation.PropertyValuesHolder_Delegate.callMethod(PropertyValuesHolder_Delegate.java:108)   at android.animation.PropertyValuesHolder_Delegate.nCallFloatMethod(PropertyValuesHolder_Delegate.java:143)   at android.animation.PropertyValuesHolder.nCallFloatMethod(PropertyValuesHolder.java:-1)   at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38)   at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1387)   at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:990)   at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:674)   at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:637)   at android.animation.ValueAnimator.start(ValueAnimator.java:1069)   at android.animation.ValueAnimator.start(ValueAnimator.java:1088)   at android.animation.ObjectAnimator.start(ObjectAnimator.java:852)   at android.animation.ValueAnimator.startWithoutPulsing(ValueAnimator.java:1081)   at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1142)   at android.animation.AnimatorSet.startAnimation(AnimatorSet.java:1227)   at android.animation.AnimatorSet.start(AnimatorSet.java:729)   at android.animation.AnimatorSet.start(AnimatorSet.java:684)   at android.animation.StateListAnimator.start(StateListAnimator.java:188)   at android.animation.StateListAnimator.setState(StateListAnimator.java:181)   at android.view.View.drawableStateChanged(View.java:21105)   at android.widget.ImageView.drawableStateChanged(ImageView.java:1294)   at com.google.android.material.floatingactionbutton.FloatingActionButton.drawableStateChanged   ... (FloatingActionButton.java:805)   at android.view.View.refreshDrawableState(View.java:21160)   at android.view.View.dispatchAttachedToWindow(View.java:18379)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)   at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)

Ad

Answer

This is a known bug that has been fixed in Studio 3.5beta2! This issue seems to be elevation properties

For more information see this: https://stackoverflow.com/a/55880655/4254527

Ad
source: stackoverflow.com
Ad