I have a problem with gradle. it was working fine but all of sudden when I was rebuilding the project it gives me this error:
Error:Failed to resolve
In my case, I've moved the Google repo on the top in the build.gradle config:
allprojects {
repositories {
google() // now here
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// google() // was here
}
}
my code was like this..
so after searching enough i solved it by adding maven in my gradle file..
its solved then..
You should add this to build.gradle(module: app)
implementation 'com.android.support:support-vector-drawable:28.0.0'
I try many but only this decoration help me to sync the Gradle, Hope this one help yours
repositories {
mavenLocal()
google()
jcenter()
}
And actually add this line to defaultConfig of app module :
vectorDrawables.useSupportLibrary = true
I faced this error on androidx project and solved it with:
1- in Build.gradle (Module file), android{} section add:
vectorDrawables.useSupportLibrary = true
2- in dependencies {} section,
change :
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
to update version:
implementation 'androidx.vectordrawable:vectordrawable:1.1.0-beta02'
compile again.
I just encountered this error along with some others:
Failed to resolve: support-vector-drawable
Failed to resolve: livedata-core
Failed to resolve: common
Failed to resolve: runtime
Failed to resolve: viewmodel
Failed to resolve: monitor
I'm not using React Native but found the answer on there:
In android/build.gradle
move the jcenter()
to the bottom:
allprojects {
repositories {
google()
maven {
url 'https://maven.google.com/'
}
jcenter()
}
}