Android java.lang.IllegalArgumentException:无效区域。Op-按钮背景中仅相交和差异失败

Android java.lang.IllegalArgumentException:无效区域。Op-按钮背景中仅相交和差异失败,android,android-studio-3.0,Android,Android Studio 3.0,android按钮后台故障 当我尝试添加 android:background="@drawable/roundedbutton" 转换到.xml文件中 <Button android:id="@+id/button_stop" style="@android:style/Widget.Button" android:layout_width="match_parent" android:layout_height="wrap_content"

android按钮后台故障

当我尝试添加

android:background="@drawable/roundedbutton"
转换到.xml文件中

<Button
     android:id="@+id/button_stop"
     style="@android:style/Widget.Button"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_margin="3dp"
     android:background="@drawable/roundedbutton"
     android:layout_weight="1"
     android:text="stop"
     android:textSize="18sp" />
谢谢。

尝试删除“style=“@android:style/Widget.Button”


更新

Android Studio 3.5 Canary 2中将包含对此的修复 java.lang.IllegalArgumentException:无效区域。Op-仅相交和差异

targetSdkVersion 28的问题

看起来这已开始在p中强制执行:

这里也有报道

你的案子的临时解决方案

使用


而不是

<corners android:bottomRightRadius="8dp"
    android:bottomLeftRadius="8dp"
    android:topRightRadius="8dp"
    android:topLeftRadius="8dp"/>

我这边也有同样的问题,现在已经解决了
build.gradle中的
targetSdkVersion 28更改为27。谢谢

这就是为我修复它的原因:

.setCropShape(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? CropImageView.CropShape.RECTANGLE : CropImageView.CropShape.OVAL)

对我来说,当我换衣服的时候,它就被修好了

<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"
android:topLeftRadius="8dp"/>


在my buttondesign.xml文件中,并替换

<Button
        android:id="@+id/btn_verify"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/yellow_btn_bg"
        android:text="Verify"
        android:textSize="16sp"
        android:layout_margin="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="20dp"
        android:layout_weight="1"
        android:textColor="@color/white"
        />



如果您在活动中遇到此问题,而您没有使用此处建议的解决方案检测到报告,则您使用的instatble库会产生此错误。。尝试更改此库的版本,您的问题将得到解决

对于那些仍然不知道如何解决此问题的人,请尝试阅读错误并了解其来源

逐行阅读所有调用堆栈,不要害怕,并找到使用函数
clipRect()
的库



它可能是一个需要更新的旧库(在我的场景中,是Lottie,它没有在build.gradle中报告我没有最新的库).

在我的例子中,错误发生在一个库中,我在该库对应的github的问题中找到了修复方法

我可以查看您的@drawable/roundedbutton文件吗?回复Batuhan:是的,我添加了xml文件。您是否使用自定义视图?尝试从buttonReply中删除style属性到Vivek:我尝试过,同样,它显示blankI无法在谷歌的跟踪器上找到bug报告,因此我创建了一个问题:@MatejDrobničgreat,谢谢我补充说谷歌的跟踪器,在我的回答中,让我们拭目以待谷歌的回应,我不知道金丝雀,但安卓Studio 3.5版本AI-191.8026.42.35.5791312(建于2019年8月9日)确实没有修复。到今天为止,这个问题还没有解决。顺便说一句,下载一个更容易出错的编译器(和一个全新的IDE),Canary,不被认为是100%有效的解决方案,所以你们应该注意不要降级您的
targetSdkVersion
,因为问题已经在
Android Studio 3.5 Canary 2
Right@NileshRathod中解决了,但是当用户无法升级Android Studio 3.5时,请将targetSdkVersion 28更改为27。同意您的意见,但正如我所说的这不是一个完美的解决方案,我从一个自由图表的绘图方法中得到了这个例外。我希望它需要更换,这就是它所使用的。我已经改为AndroidX,它需要API 28,并且还实现了AppCompatActivity(因为我在Android 9中的菜单在黑暗的背景下是黑色的,尽管它们已经很长时间没有问题了)。所以回到过去不仅仅是回到API 27。如果他们能把它修好就好了。android studio 3.6.2和问题仍然存在。我知道你说的是哪个库XD。不需要这样做。。。只需更新到库的2.8.0版本,问题就会得到解决
<corners android:bottomRightRadius="8dp"
    android:bottomLeftRadius="8dp"
    android:topRightRadius="8dp"
    android:topLeftRadius="8dp"/>
.setCropShape(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? CropImageView.CropShape.RECTANGLE : CropImageView.CropShape.OVAL)
<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"
android:topLeftRadius="8dp"/>
<corners
android:radius="8dp"/>
<Button
        android:id="@+id/btn_verify"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/yellow_btn_bg"
        android:text="Verify"
        android:textSize="16sp"
        android:layout_margin="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="20dp"
        android:layout_weight="1"
        android:textColor="@color/white"
        />
<Button
        android:id="@+id/btn_verify"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/yellow_btn_bg"
        android:text="Verify"
        android:textSize="16sp"
        android:layout_margin="20dp"
        android:layout_weight="1"
        android:textColor="@color/white"
        />