Reputation: 6823
When trying to Sync Gradle I am getting the following error:
A problem occurred configuring project ':react-native-google-signin'.
> Could not resolve all artifacts for configuration ':react-native-google-signin:classpath'.
> Could not find com.android.tools.build:gradle:3.6.3.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.jar
Required by:
project :react-native-google-signin
I have had a search and I am unable to find an answer to this. A similar question here: React native android can not find com.android.tools.build:gradle:3.6.3
Looking at the above this suggests switching off Offline mode, which is not on, so, unfortunately, that is not the answer.
The root bundle.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
maven {
url 'https://maven.google.com/'
}
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven { url 'https://dl.bintray.com/android/android-tools' }
maven {url "$projectDir/../node_modules/react-native/android"}
}
dependencies {
classpath('com.android.tools.build:gradle:3.4.1')
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// React native video - exoplayer missing from google repos, temp fix
maven {
url "https://google.bintray.com/exoplayer/"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
// configurations.all {
// resolutionStrategy {
// force 'com.facebook.android:facebook-android-sdk:4.28.0'
// }
// }
}
}
Based on the error it seems it only searches in jcenter and not the others? I am not sure, but when I searched online this specific build is available from maven.google.com which is included?
Upvotes: 5
Views: 14758
Reputation: 1
The biggest problems I have encountered with this type of situations are caused by the coordinate that contains the version with which the dependency is being verified, I recommend that you look for the most recent version that is compatible with the project, sometimes when you look for this dependency it may not be available com.android.tools.build:gradle:x.x.x and sometimes the functionality is not what you require, so you have to increase the version number.
Upvotes: 0
Reputation: 55
It's specifically something wrong with the gradle.build (module or project file), I got that error in compile time and I'm not written a proper syntex, since build.gradle(groovy) didn't support any systex error while typing
Upvotes: 0
Reputation: 686
After spending 2 days finally resolved this issue, actually What I was doing that
maven { url 'https://jitpack.io' }
this line added in both repositories section , So remove the line you added in repositories section inside buildScript.
in build.gradle (project module)
buildscript {
ext.kotlin_version = "1.4.31"
repositories {
google()
jcenter()
gradlePluginPortal()
}
dependencies {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0"
classpath "com.android.tools.build:gradle:7.0.2"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
don't add maven at above repositories section , do like save above code. hope your problem resolved
Upvotes: 0
Reputation: 461
I got this error after enabling flutter web which automatically upgraded my gradle file, so firstly disable your flutter web and update your compileSdkVersion and targetSdkVersion to the last version which is up to now 30
Upvotes: 0
Reputation: 75788
You should move to Androidx
AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. You can migrate an existing project to AndroidX
by selecting Refactor > Migrate to AndroidX
from the menu bar.
Upgrade
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.2'
And
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
Upvotes: 1
Reputation: 133
Replace your android/build.gradle with this i.e in your project level gradle with this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {url "https://maven.google.com"} //<---- this should be added and should be aboce jcenter
maven {url "$rootDir/../node_modules/react-native/android"}
jcenter()
}
}
After that clear your gradle inside android/
gradlew clean
Then run the react native application.
NOTE: Use your own gradle and google service versions in above snippet
Upvotes: 1