react-native-contacts icon indicating copy to clipboard operation
react-native-contacts copied to clipboard

Could not find com.android.tools.build:gradle:2.3.1

Open raghavendramogeraya opened this issue 7 years ago • 12 comments

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.

raghavendramogeraya avatar Dec 11 '18 06:12 raghavendramogeraya

i am also getting same error .

raginisahu avatar Dec 11 '18 06:12 raginisahu

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.

raginisahu avatar Dec 11 '18 06:12 raginisahu

same issue

kashishgrover avatar Dec 11 '18 09:12 kashishgrover

I have the same error, any leads ?

sakymar avatar Dec 11 '18 09:12 sakymar

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

sakymar avatar Dec 11 '18 09:12 sakymar

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.

kashishgrover avatar Dec 11 '18 10:12 kashishgrover

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 avatar Dec 11 '18 11:12 kashishgrover

Same trouble https://github.com/wkh237/react-native-fetch-blob/issues/734

jershell avatar Dec 11 '18 11:12 jershell

@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?

morenoh149 avatar Dec 11 '18 21:12 morenoh149

This issue is resolved now, as the repositories are back now.

raghavendramogeraya avatar Dec 12 '18 04:12 raghavendramogeraya

@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 avatar Dec 13 '18 08:12 kashishgrover

@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?

morenoh149 avatar Dec 14 '18 17:12 morenoh149