java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE in Button background failure

孤街醉人 提交于 2019-11-27 01:59:22

UPDATE

The fix for this will be included in Android Studio 3.5 Canary 2

java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE

The issue with targetSdkVersion 28

Looks like this started being enforced in P: https://developer.android.com/reference/android/graphics/Canvas#clipRect(android.graphics.RectF,%20android.graphics.Region.Op)

also reported here

Temporary solution for your case

Use

<corners
    android:radius="8dp"/>

instead of

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

Same issue occur in my end, it was fixed now Change the targetSdkVersion 28 to 27 in build.gradle. Thanks

This is what fixed it for me:

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

Try this

    <shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke android:width="2dp" android:color="@color/black"   />
    <solid android:color="@color/black" />
    <corners android:radius="7dp" />

</shape>

try removing " style="@android:style/Widget.Button"".

 <Button
            android:id="@+id/button_stop"
            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" />
Soumya Mishra

For me it got fixed up when I changed

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

to

<corners
android:radius="8dp"/>

in my buttondesign.xml file and replaced

<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"
        />

with

<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"
        />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!