cardview androdix dependency

Viewed 168

I tried to implement cardview in android studio but after putting

implementation 'androidx.cardview:cardview:1.0.0'

under dependencies and syncing...

This error occurred:

Build file 'C:\Users\USER\AndroidStudioProjects\LearnALanguage\build.gradle' line: 10

A problem occurred evaluating root project 'LearnALanguage'.

Could not find method implementation() for arguments [androidx.cardview:cardview:1.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I am using android-studio-ide-182.5314842-windows.

1 Answers

I hope you have added the required dependency in the app level Gradle file [android/app/build.gradle]. What is your cardView class in the layout file? It should be

<androidx.cardview.widget.CardView>

And if you are using the old class “android.support.v7.widget.CardView” then you need to add android:enableJetifier=true to your gradle.properties file.

Related