feona inocen
feona inocen

Reputation: 21

cardview androdix dependency

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.

Upvotes: 2

Views: 876

Answers (1)

Akki
Akki

Reputation: 823

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.

Upvotes: 1

Related Questions