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

UPDATE

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

enter image description here

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

  • https://issuetracker.google.com/issues/121235731
  • https://github.com/facebook/stetho/issues/607
  • https://github.com/ArthurHub/Android-Image-Cropper/issues/553
  • https://github.com/ArthurHub/Android-Image-Cropper/pull/588

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)