CardView 导致应用程序崩溃(如图所示)

CardView is causing app to crash (shown in the picture)

每次我 运行 代码时我总是崩溃,我试图删除 CardView 代码并且它不再崩溃了。你们能帮帮我吗,因为我是这个环境的新手,目前正在做一个项目,我是不是用 cardView 代码做错了?谢谢

crashed app

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bgapps"
    tools:context=".utama">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp">

            <androidx.cardview.widget.CardView
                android:id="@+id/cardCam"
                android:layout_width="120dp"
                android:layout_height="125dp"
                android:layout_below="@+id/cardPupuk"
                android:layout_marginStart="125dp"
                android:layout_marginTop="40dp"
                android:layout_marginEnd="@+id/soilIv"
                app:cardBackgroundColor="#989595"
                app:cardCornerRadius="12dp">

                <ImageView
                    android:id="@+id/camIv"
                    android:layout_width="71dp"
                    android:layout_height="71dp"
                    android:layout_gravity="center"
                    android:src="@drawable/cam" />
            </androidx.cardview.widget.CardView>
        </RelativeLayout>
    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

android:layout_marginEnd

Specifies extra space on the end side of this view. This space is outside this view's bounds. Margin values should be positive.

您应该在 androidx.cardview.widget.CardView 部分使用正确的值。

不要

 android:layout_marginEnd="@+id/soilIv"

应该是

android:layout_marginEnd="10dp"