i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies

i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies

If you are using Android Studio 3.0 or above make sure your project build.gradle should have content similar to-
buildscript {
repositories {
google() // add google() before jcenter()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google() // add google() before jcenter()
jcenter()
}
}
And for below Android Studio 3.0 and starting from support libraries 26.+ your project build.gradle must look like this-
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Note- position really matters add google() before jcenter()
check these links below for more details-
Just add this to your main all project level build.gradle file under allprojects()
maven {
url "https://maven.google.com"
}
Google's new Maven repo is required for the latest support library that is compatible with Android 8.0. Just update your Google's Maven repository like below:
To add them to your build, add maven.google.com to the Maven repositories in your module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Alternative you can update build.gradle file like this:
repositories {
jcenter()
google()
}
Then add the desired library to your dependencies block. For example, the cardview library looks like this:
dependencies {
compile 'com.android.support:cardview-v7:26.1.0'
}
in sdk 28 u can use
implementation 'com.android.support:design:28.0.0'
and remove cardView library
I had this issue when creating a new project in Android Studio using Kotlin. The way that finally helped me:
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
google()
jcenter()
}
}
Ionic 4, opened /platforms/android/platform.properties, changed the version of the listed library throwing the error (in my case, com.android.support:support-v4:27.+) to:
com.android.support:support-v4:28.+
compile 'com.android.support:cardview-v7:+'
This should pull the most recent version, and allow it to compile.
@Aryan is correct Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)
A picture worth thousand words
For me I just had to clean my project.
Build -> Clean Project
Another time I had to:
File -> Sync Project with Gradle Files.
2 Steps to fix this.. 1, connect to internet. 2, Click on clean project. this will fix it :)
When you sync this dependency to the android studio:
implementation 'com.android.support:cardview-v7:26.0.1-alpha1'
Then, Sync the Gradle with Project Files. It will say, (Suppose if you are working on new ones like androidx) obviously, it will show error on the dependency.
For that you can go to the File menu and click on the invalidate/restart the code. It will resolve itself and the application will restart without any error.