Material-components-android: Android Studio 3.4.1 Render Problem With AppBarLayout

Created on 11 Jun 2019  路  13Comments  路  Source: material-components/material-components-android

It happened after use
com.google.android.material.appbar.AppBarLayout (lib version: 1.1.0-alpha07)
in xml

Most helpful comment

I got the same problem. I don't know the problem only appeared in 3.4.1 only or not.

java.lang.IllegalArgumentException: java.lang.ClassCastException@7167546 at sun.reflect.GeneratedMethodAccessor307.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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) 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.animateBasedOnTime(ValueAnimator.java:1339) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1471) 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:947) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer_Delegate.doFrame(Choreographer_Delegate.java:66) at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:559) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:425) at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:120) at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:151) at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:133) at com.android.tools.idea.rendering.RenderTask.lambda$null$8(RenderTask.java:755) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

If I want to show the preview I must to get rid the AppBarLayout (make the code to be a comment).

All 13 comments

got this after force refresh layout

java.lang.IllegalArgumentException: java.lang.ClassCastException@199bfe3d at sun.reflect.GeneratedMethodAccessor1027.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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) 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.StateListAnimator.start(StateListAnimator.java:188) at android.animation.StateListAnimator.setState(StateListAnimator.java:181) at android.view.View.drawableStateChanged(View.java:21105) at android.view.ViewGroup.drawableStateChanged(ViewGroup.java:7101) at com.google.android.material.appbar.AppBarLayout.drawableStateChanged(AppBarLayout.java:393) at android.view.View.refreshDrawableState(View.java:21160) at android.view.View.dispatchAttachedToWindow(View.java:18379) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3397) 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) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:335) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:391) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:195) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:540) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$5(RenderTask.java:666) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I guess that the problem from this line, com.google.android.material.appbar.AppBarLayout.drawableStateChanged(AppBarLayout.java:393)

I got the same problem. I don't know the problem only appeared in 3.4.1 only or not.

java.lang.IllegalArgumentException: java.lang.ClassCastException@7167546 at sun.reflect.GeneratedMethodAccessor307.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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) 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.animateBasedOnTime(ValueAnimator.java:1339) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1471) 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:947) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer_Delegate.doFrame(Choreographer_Delegate.java:66) at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:559) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:425) at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:120) at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:151) at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:133) at com.android.tools.idea.rendering.RenderTask.lambda$null$8(RenderTask.java:755) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

If I want to show the preview I must to get rid the AppBarLayout (make the code to be a comment).

got the same problem. Any fix available?

Use
implementation 'com.google.android.material:material:1.0.0'

Use
implementation 'com.google.android.material:material:1.0.0'

@srinis777 There's a feature that I can only get it at the latest version.

This should be fixed in Android Studio 3.5, which is currently in beta - https://developer.android.com/studio/preview.

https://issuetracker.google.com/issues/132316448

i have same issue.
I'm using Android Studio 3.4.2
Build #AI-183.6156.11.34.5692245, built on June 27, 2019
JRE: 1.8.0_152-release-1343-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

I had the same problem, and it disappear after the material library being modified to com.google.android.material:material:1.1.0-alpha08

i have same issue.
I'm using Android Studio 3.4.2
Build #AI-183.6156.11.34.5692245, built on June 27, 2019
JRE: 1.8.0_152-release-1343-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Upgrading to Android Studio 3.5 RC (android-studio-ide-191.5717577-windows) solved my issue. AppBarLayout is rendering perfectly now.

Temporary solution is downgrade to com.google.android.material:material:1.1.0-alpha07

Both 1.1.0-alpha07 and 1.1.0-alpha08 appears to be buggy. See the same empty UI Design Editor.

Both 1.1.0-alpha07 and 1.1.0-alpha08 appears to be buggy. See the same empty UI Design Editor.

Not only empty, but the designs with recyclerview are also shown messed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sepehr-alipour picture sepehr-alipour  路  3Comments

gabrielemariotti picture gabrielemariotti  路  3Comments

jaychang0917 picture jaychang0917  路  3Comments

JavierSegoviaCordoba picture JavierSegoviaCordoba  路  3Comments

Sanusy picture Sanusy  路  3Comments