android Button background failure
when I try to add
android:background=\"@drawable/roundedbutton\"
into the .xml
&
This is what fixed it for me:
.setCropShape(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? CropImageView.CropShape.RECTANGLE : CropImageView.CropShape.OVAL)
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" />
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"
/>
UPDATE
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"/>
For those of you who still haven't figured out how to solve this, just Try to read the error and understand where it stems from.
Read all the call stack, don't be afraid, line by line, and find the library which use the function clipRect()
.
Its probably an old library which you need to updated (in my scenario, it was Lottie, which didn't report in the build.gradle that I haven't had the most recent library).
if you encounter this problem in an activity while you do not detect the report with the solutions proposed here, it is that you use an instatble library which generates this error .. try to change the version of this library, and your problem will be solved