如何解决 Path.op() 不支持的渲染问题?
how to solve render problem Path.op() not supported?
如何解决这个错误:
渲染问题
Path.op() 不支持
我试过强制刷新布局,重启,更新Android Studio,停止杀毒一段时间,问题依旧
令人惊讶的是我能够编译 运行 应用程序,但是如何摆脱这个错误?
我正在使用:
- Android Studio 3.5.3
- Android SDK 工具 29.0.2
- Android SDK 平台 Android 10.0 (Q) Android SDK 平台 29
- 默认 OpenJDK 平台二进制文件
重现错误:
- 用空 activity
创建新的 Android 项目
将布局替换为以下布局:
<?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>
我昨天遇到了同样的问题。我的与
有关
com.google.android.material.appbar.AppBarLayout
组件。
我不知道为什么,但添加 android:background="..."
解决了它。
我遇到了同样的问题。原因是 Material 组件的新版本与此错误捆绑在一起。因此,我尝试用支持 Path.op()
.
的版本替换 Gradle 构建脚本中的版本
所以,您唯一需要做的就是用这个替换 Gradle 构建脚本中的依赖项:
implementation 'com.google.android.material:material:1.2.0-alpha02'
我遇到了同样的问题。当我 运行 应用程序时问题得到改善。我认为当你清除并重建你的项目时,问题会得到改善。
使用芯片时遇到同样的问题,它在布局编辑器中不可见。通过更改
解决了它
implementation 'com.google.android.material:material:1.2.0-alpha03'
至
implementation 'com.google.android.material:material:1.2.0-alpha02'
问题已通过替换 Gradle 构建中的 material 组件实现解决(在应用程序级别)
com.google.android.material:material:1.2.0-alpha05
至
com.google.android.material:material:1.2.0-alpha02
替换
实现文件树(目录:'libs',包括:['*.jar'])
api 'com.google.android.material:material:1.2.0-alpha06'
到
实现文件树(目录:'libs',包括:['*.jar'])
api 'com.google.android.material:material:1.2.0-alpha02'
有点晚了但是
implementation 'com.google.android.material:material:1.2.0-alpha06'
工作正常,因此无需再降级到 alpha02。
任何遇到这个问题的人都会降级或升级你 material 设计依赖
至
implementation 'com.google.android.material:material:1.2.0-alpha02'
在渲染方面似乎更稳定,特别是如果您使用 android studio V3.4 及更高版本。
我有时会想念日食
如果您在内部使用“ImageView”,请确保它们的 XML 代码是这样的。
您的默认生成可能如下所示。
Wrong XML Code
将 (tools:srcCompat="@drawable/img_avatar") 更改为 (android:src="@drawable/img_avatar") like以下
Correct XML Code
我想它会为您解决这个问题。谢谢。
其他详细信息:-
My Android Studio Version
My Gradle Dependencies
当我尝试在 ImgView 中显示 PNG 时,我 运行 遇到了这个问题。
刚刚更新:版本 1.3.0-rc01 已经启动。您可以使用
implementation 'com.google.android.material:material:1.3.0-rc01'
该错误似乎已在 material 组件的最新版本中得到解决,该组件当前为:
implementation 'com.google.android.material:material:1.3.0'
使用新的布局渲染引擎帮助解决了我的问题。转到设置 -> 实验 -> 使用新的布局渲染引擎
只是不要定义版本:
实施 'com.google.android.material:material'
它对我有用。
对我来说,只有从 androidx.recyclerview.widget.RecyclerView 中删除 fastScroll 设置后,问题才解决。
改变依赖关系对我有用:
implementation 'com.google.android.material:material:1.2.0'
使用实验渲染引擎,解决了我的问题。首先由 Carlos 建议。
以下是在 android 工作室中的操作方法。
转到文件 > 设置
现在将显示设置 window。
转到 Experimental 选项卡和 check/tick Use new Layout Rendering Engine
就是这样!
如何解决这个错误: 渲染问题 Path.op() 不支持
我试过强制刷新布局,重启,更新Android Studio,停止杀毒一段时间,问题依旧
令人惊讶的是我能够编译 运行 应用程序,但是如何摆脱这个错误?
我正在使用:
- Android Studio 3.5.3
- Android SDK 工具 29.0.2
- Android SDK 平台 Android 10.0 (Q) Android SDK 平台 29
- 默认 OpenJDK 平台二进制文件
重现错误:
- 用空 activity 创建新的 Android 项目
将布局替换为以下布局:
<?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>
我昨天遇到了同样的问题。我的与
有关com.google.android.material.appbar.AppBarLayout
组件。
我不知道为什么,但添加 android:background="..."
解决了它。
我遇到了同样的问题。原因是 Material 组件的新版本与此错误捆绑在一起。因此,我尝试用支持 Path.op()
.
所以,您唯一需要做的就是用这个替换 Gradle 构建脚本中的依赖项:
implementation 'com.google.android.material:material:1.2.0-alpha02'
我遇到了同样的问题。当我 运行 应用程序时问题得到改善。我认为当你清除并重建你的项目时,问题会得到改善。
使用芯片时遇到同样的问题,它在布局编辑器中不可见。通过更改
解决了它implementation 'com.google.android.material:material:1.2.0-alpha03'
至
implementation 'com.google.android.material:material:1.2.0-alpha02'
问题已通过替换 Gradle 构建中的 material 组件实现解决(在应用程序级别)
com.google.android.material:material:1.2.0-alpha05
至
com.google.android.material:material:1.2.0-alpha02
替换
实现文件树(目录:'libs',包括:['*.jar'])
api 'com.google.android.material:material:1.2.0-alpha06'
到
实现文件树(目录:'libs',包括:['*.jar'])
api 'com.google.android.material:material:1.2.0-alpha02'
有点晚了但是
implementation 'com.google.android.material:material:1.2.0-alpha06'
工作正常,因此无需再降级到 alpha02。
任何遇到这个问题的人都会降级或升级你 material 设计依赖 至
implementation 'com.google.android.material:material:1.2.0-alpha02'
在渲染方面似乎更稳定,特别是如果您使用 android studio V3.4 及更高版本。 我有时会想念日食
如果您在内部使用“ImageView”,请确保它们的 XML 代码是这样的。
您的默认生成可能如下所示。 Wrong XML Code
将 (tools:srcCompat="@drawable/img_avatar") 更改为 (android:src="@drawable/img_avatar") like以下 Correct XML Code
我想它会为您解决这个问题。谢谢。
其他详细信息:- My Android Studio Version My Gradle Dependencies
当我尝试在 ImgView 中显示 PNG 时,我 运行 遇到了这个问题。
刚刚更新:版本 1.3.0-rc01 已经启动。您可以使用
implementation 'com.google.android.material:material:1.3.0-rc01'
该错误似乎已在 material 组件的最新版本中得到解决,该组件当前为:
implementation 'com.google.android.material:material:1.3.0'
使用新的布局渲染引擎帮助解决了我的问题。转到设置 -> 实验 -> 使用新的布局渲染引擎
只是不要定义版本: 实施 'com.google.android.material:material' 它对我有用。
对我来说,只有从 androidx.recyclerview.widget.RecyclerView 中删除 fastScroll 设置后,问题才解决。
改变依赖关系对我有用:
implementation 'com.google.android.material:material:1.2.0'
使用实验渲染引擎,解决了我的问题。首先由 Carlos 建议。
以下是在 android 工作室中的操作方法。
转到文件 > 设置
现在将显示设置 window。
转到 Experimental 选项卡和 check/tick Use new Layout Rendering Engine
就是这样!