Android Gradle Plugin 3.0+ sync issue

Cross references

  1. Gradle sync issue on Debian OS due to user does not have permission
  2. Gradle proxy configuration
* What went wrong:
A problem occurred configuring root project 'idp-main'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find gradle.jar (com.android.tools.build:gradle:3.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
   > Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.1/gradle-core-3.0.1.jar
   > Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle-api/3.0.1/gradle-api-3.0.1.jar
   > Could not find compilerCommon.jar (com.android.databinding:compilerCommon:3.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/databinding/compilerCommon/3.0.1/compilerCommon-3.0.1.jar
   > Could not find builder.jar (com.android.tools.build:builder:3.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar
   ...
   > Could not find lint-api.jar (com.android.tools.lint:lint-api:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-api/26.0.1/lint-api-26.0.1.jar
   > Could not find sdk-common.jar (com.android.tools:sdk-common:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/sdk-common/26.0.1/sdk-common-26.0.1.jar
   ...
   > Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/analytics-library/tracker/26.0.1/tracker-26.0.1.jar
   ...
   > Could not find sdklib.jar (com.android.tools:sdklib:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/sdklib/26.0.1/sdklib-26.0.1.jar
   ...
   > Could not find repository.jar (com.android.tools:repository:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/repository/26.0.1/repository-26.0.1.jar
  ...
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

Android introduced its own maven repository “google()” since Android gradle plugin 3.0, and you have to configure your root build.gradle as below. Note that this repo HAS TO be put before the “jcenter()” maven repository, if any, so that above sync error can be avoided.

buildscript {
    repositories {
        //jcenter() //Should remove this repository for Android Gradle Plugin 3.0+, and use google() repository as shown below
        google()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

 

 

 

 

 

 

 

2 thoughts on “Android Gradle Plugin 3.0+ sync issue

  1. Pingback: Gradle proxy configuration – Arophix

  2. Pingback: Gradle sync issue on Debian OS due to user does not have permission – Arophix

Leave a comment