Getting the below error since yesterday while generating build at App Center.
But it is not mentioned in my gradle file
Build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
Error:
A problem occurred configuring project ':react-native-contacts'.
> Could not resolve all artifacts for configuration ':react-native-contacts:classpath'.
> Could not find com.android.tools.build:gradle:2.3.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
Required by:
project :react-native-contacts
Please help to resolve the issue.
i am also getting same error .
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
it will help you.
same issue
I have the same error, any leads ?
found this :
subprojects { project ->
def name = project.name
if (name.contains('react-native-contacts')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
} }
to add in the build.gradle
From what I have been able to figure, this is happening for a lot of libraries right now.
If you notice on com.android.tools.build on maven.google.com, they seem to have removed Gradle jars lower than v3.0.0.
I am facing the same issue with react-native-linear-gradient v2.4.0 and also my project as a whole which is currently on RN 0.52 with Gradle v2.2.3.
In the manner you mentioned above, right now I am adding maven { url 'http://repo.spring.io/plugins-release' } for all the dependencies which seem to be on older Gradle versions since this URL still serves those. Let's see if this fixes the problem. Will update here.
Yup, this fixed it. Add this to your project's build.gradle
buildscript { . . .
allprojects { . . .
subprojects { project ->
def name = project.name
if (name.contains('react-native-contacts') ||
name.contains('react-native-svg') ||
name.contains('react-native-linear-gradient') ||
name.contains('react-native-shimmer')
) {
buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
}
}
}
}
@kashishgrover is there a way to write PR so this is fixed for users of this module? should the readme instruct to add that to gradle?
This issue is resolved now, as the repositories are back now.
@morenoh149 I don't think there can ever be a permanent fix for such things. In this case randomly the repos disappeared from jcenter which should not have happened. Meanwhile as a check I did add the above code to my project. I think leaving that to the user makes more sense.
@kashishgrover I thought it was an issue with google updating the gradle version being used. And thus the older dependency was deleted from the location. We merged this update https://github.com/rt2zz/react-native-contacts/commit/62bafa5dbd181b01f45f9d56b2bbec88218fe8af which may be why things are working now?
Most helpful comment
This issue is resolved now, as the repositories are back now.