Как я могу решить проблему рендеринга в новой версии android studio (androidx)? - PullRequest
0 голосов
/ 01 июля 2019

Я обновил свою андроид-студию до последней версии, создал новый проект и добавил навигационную панель, но предварительный просмотр не работает правильно для некоторых макетов. Показана некоторая проблема рендеринга.

Я уже изменил «Theme.AppCompat.Light.DarkActionBar» на «Base.Theme.AppCompat.Light.DarkActionBar» и попытался понизить версию API, но ничего не изменилось.

<androidx.drawerlayout.widget.DrawerLayout 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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_navigation_drawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_navigation_drawer"
        app:menu="@menu/activity_navigation_drawer_drawer" />

</androidx.drawerlayout.widget.DrawerLayout>

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)

Ответы [ 2 ]

0 голосов
/ 16 июля 2019

Я столкнулся с той же проблемой.Версия Android 3.4.2.Это кеш ясно не решает это.Единственное исправление - закрыть андроид студию и перезагрузить.Это происходит через несколько раз снова.

0 голосов
/ 02 июля 2019

https://developer.android.com/jetpack/androidx/migrate Перейдите по вышеуказанной ссылке и выполните процедуру.Измените макеты с помощью макетов Android.

...