简体   繁体   中英

How can I resolve the render problem in the new Android Studio version (Androidx)?

I updated my Android Studio to the latest version and created a new project and added a navigation drawer but the preview is not working correctly for some layouts. There is a render problem shown. I created a new project with Androidx.

I already changed the Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar and tried to downgrade the API but nothing changed.

Here is the error log I get:

java.lang.IllegalArgumentException: java.lang.ClassCastException@682acdca 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.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.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404) at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)

https://developer.android.com/jetpack/androidx/migrate Go through the above link and follow the procedure. Change the layouts with androidx layouts.

I am facing also same problem. Android Version 3.4.2. Cache clear doesn't solve it. Only fix is close Android Studio and restart it. It happened some times later again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM