0

i have an error this his my code

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'androidx.cardview:cardview:1.0.0'

and for xml

<android.support.v7.widget.CardView
            android:id="@+id/card_view"
            android:layout_width="match_parent"
            android:layout_height="293dp"
            app:cardBackgroundColor="@color/card"
            app:cardCornerRadius="10dp"
            app:cardElevation="5dp"
            app:cardUseCompatPadding="true">

            <TextView
                android:id="@+id/textView4"
                android:layout_width="432dp"
                android:layout_height="510dp"
                android:text="TextView" />

            <WebView
                android:id="@+id/webview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:ignore="WebViewLayout" />
        </android.support.v7.widget.CardView>

With this lines of code the app stop and I try only with the dependencies line and I didn't put the line of code for XML, with only the dependencies implementation cardview lines and hid didn't stop but when I put the line of code for the XML file the app stop.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

You have the androidx version of CardView in your gradle file:

implementation 'androidx.cardview:cardview:1.0.0'

But you're using the old version of CardView in your layout file:

<android.support.v7.widget.CardView ... />

You have to use the same version in both. So replace the tag in your layout file with this:

<androidx.cardview.widget.CardView ... />
Ben P.
  • 52,661
  • 6
  • 95
  • 123