1

When I try to build my android project it shows some gradle error. The error is as follows,

Error:Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
    D4D.libs:ViewPagerIndicator-Library:unspecified

If anybody know how to fix this error please help me.

my build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }

    dependencies {

        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
UmarZaii
  • 1,355
  • 1
  • 17
  • 26
Astro
  • 201
  • 1
  • 12
  • Possible duplicate of [Gradle error : Could not find com.android.tools.build:gradle:2.2.3](https://stackoverflow.com/questions/41570435/gradle-error-could-not-find-com-android-tools-buildgradle2-2-3) – Sree Jul 17 '17 at 04:37

2 Answers2

0

This is because the build process is unable to find the dependency in Maven repository. Add jcenter() along with mavenCentral() in your project level build.gradle file.

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
    }
}

see this

Arnold Brown
  • 1,330
  • 13
  • 28
0

according to this answer https://stackoverflow.com/a/39654136/8284461, maybe you need to add mavenCentral() in your repositories. the gradle would be like this

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {

        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
azisuazusa
  • 317
  • 1
  • 12