如何解决此错误: 渲染问题 不支持Path.op()
我试图强制刷新布局,重新启动,更新Android Studio,暂时停止防病毒,但是问题仍然存在。
令人惊讶的是,我能够编译并运行该应用程序,但是如何摆脱此错误?
我正在使用:
重现该错误:
使用以下布局替换该布局:
<?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent_view"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@android:color/white">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="none"
android:scrollingCache="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="0dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@android:color/darker_gray" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="14dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title is going here"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/brief"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Location"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_dots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="end"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<View
android:layout_width="0dp"
android:layout_height="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/darker_gray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:lineSpacingExtra="4dp"
android:text="very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum very_long_lorem_ipsum "
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@android:color/darker_gray"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="8dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
答案 0 :(得分:34)
我面临着同样的问题。原因是新版本的Material Components与此错误捆绑在一起。因此,我尝试用支持Path.op()
的版本替换Gradle构建脚本中的版本。
因此,您唯一要做的就是用以下代码替换Gradle构建脚本中的依赖项:
实现'com.google.android.material:material:1.2.0-alpha02'
答案 1 :(得分:11)
通过替换Gradle Build中的材料组件实现(在应用程序级别)解决了问题
com.google.android.material:material:1.2.0-alpha05
到
com.google.android.material:material:1.2.0-alpha02
答案 2 :(得分:3)
有点晚了
implementation 'com.google.android.material:material:1.2.0-alpha06'
正常工作,因此无需再降级为alpha02。
答案 3 :(得分:2)
该错误似乎已在当前最新版本的材料组件中得到解决:
implementation 'com.google.android.material:material:1.3.0'
答案 4 :(得分:1)
昨天我遇到了同样的问题。我与
有关com.google.android.material.appbar.AppBarLayout
组件。
我不知道为什么,但是添加android:background="..."
就可以解决。
答案 5 :(得分:1)
我遇到了同样的问题。当我运行应用程序时,该问题得到了改善。我认为当您清除并重建项目后,该问题将得到改善。
答案 6 :(得分:1)
使用新的布局渲染引擎帮助解决了我的问题。转到设置 -> 实验 -> 使用新的布局渲染引擎
答案 7 :(得分:0)
使用芯片时遇到相同的问题,在布局编辑器中不可见。通过更改来解决
implementation 'com.google.android.material:material:1.2.0-alpha03'
到
implementation 'com.google.android.material:material:1.2.0-alpha02'
答案 8 :(得分:0)
替换
实现fileTree(dir:'libs',包括:['* .jar'])
HtmlCollectionItems
到
实现fileTree(dir:'libs',包括:['* .jar'])
api 'com.google.android.material:material:1.2.0-alpha06'
答案 9 :(得分:0)
遇到此问题的任何人都只能降级或升级您对材料设计的依赖性 到
implementation 'com.google.android.material:material:1.2.0-alpha02'
似乎在渲染方面更加稳定,尤其是在使用android studio V3.4及更高版本的情况下。 我有时会想念日食
答案 10 :(得分:0)
如果您在内部使用“ ImageView”,请确保其XML代码是这样的。
您生成的默认值可能如下所示。 Wrong XML Code
将(tools:srcCompat =“ @ drawable / img_avatar”)更改为(android:src =“ @ drawable / img_avatar”),如下所示 Correct XML Code
我认为它将为您解决该问题。谢谢。
其他详细信息:- My Android Studio Version My Gradle Dependencies
当我尝试在ImgView中显示PNG时遇到了这个问题。
答案 11 :(得分:0)
刚更新:1.3.0-rc01版本已经上线。你可以使用
implementation 'com.google.android.material:material:1.3.0-rc01'
答案 12 :(得分:0)
只是不要定义版本: 实现 'com.google.android.material:material' 它对我有用。
答案 13 :(得分:0)
对我来说,只有在从 androidx.recyclerview.widget.RecyclerView 中删除 fastScroll 设置后,才解决了问题。
答案 14 :(得分:0)
更改依赖项对我有用:
implementation 'com.google.android.material:material:1.2.0'
答案 15 :(得分:0)
使用实验渲染引擎,它为我解决了这个问题。首先由Carlos推荐。
这是在 android studio 中的操作方法。
转到“文件”>“设置”
现在将显示设置窗口。
转到实验标签并勾选/勾选使用新的布局渲染引擎
就是这样!