I am getting this error during gradle build in android studio. And I am unable to figure out what I am missing.
Error:Could not find com.android.tools.build:gradle:2.3.3. Searched in the
following locations:
file:/C:/Program Files/Android/Android
Studio/gradle/m2repository/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom
file:/C:/Program Files/Android/Android
Studio/gradle/m2repository/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.jar
https://maven.google.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom
https://maven.google.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.jar
Here is my build.gradlefile configuration
`
all sub-projects/modules.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://jitpack.io'
}
}
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
supportlib_version = '26.0.2'
gps_version = '11.2.0'
}
//Ensure that all dependencies use the same version of the Android Support library
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version"
}
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$gps_version"
}
}
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
`
Could you help me what am I missing?
Add jcenter() to buildscript repositories if you are using gradle plugin 2.x.
Here's a copy of build.gradle(Project) from my old project.
buildscript {
repositories {
// for 2.x
jcenter()
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
If your gradle (the one distributed by Gradle) version is low,
also need to edit gradle-wrapper.properties.
Minimum version of Gradle is 3.3 for plugin 2.3.3.
Plugin version 2.3.0+ :
Required Gradle version 3.3+
gradle-wrapper.properties sample:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Please see Update Gradle. Available versions are listed in this page.
For information:
This exists (jcenter).
https://bintray.com/android/android-tools/com.android.tools.build.gradle/2.3.3
This does not exist (Google's Maven repository). It's from 3.0, I think.
https://maven.google.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom
This exists
https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
For Gradle version >= 3.0.0
Please see Update the Android Plugin for Gradle and Update Gradle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With