10

I have tried many thing that is mentioned on the internet but still i am unable to resolve the issue ,while sync it's showing me following error

Error:Could not find com.android.tools.build:gradle:3.4.1.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.jar
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.jar
Required by:
    project :

I have changed the gradle-wrapper.properties in gradle of my projectlike this and sync the project

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
1
  • create new project and see if prompt for update comes or not.coz i updated today like this Commented Mar 9, 2017 at 17:43

4 Answers 4

9

First of all you should add the dependency in Project's build.gradle:

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

And check all repositories groups that they contain google() repository:

repositories {
    jcenter()
    google()
}

After that in gradle-wrapper.properties you should change the distributionUrl:

https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0
7

Downgrade your version com.android.tools.build:gradle:3.4.1. is not found in https://jcenter.bintray.com/com/android/tools/build/gradle/ repository.

Include the below classpath in your respective module.

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

Or Download the latest gradle through the below link

https://gradle.org/releases

and include the directory in your project setting.

6

Go to Android Studio -> Preferences -> Search for "Gradle" to open your gradle settings.

There you need to tick "Use local gradle distribution" and point it to the folder where the Gradle binaries live.

In case you haven't done that. Go here and download the latest Gradle binaries. Extract them somewhere in your machine and add the path of the extraction location as seen in the picture below :)

That should fix it

EDIT: This setting works in a "per-project" basis.

enter image description here

0

I just had to let Android Studio update a whole bunch of things like adding google to the repositories, upgrading the gradle wrapper and moving the android minsdk version from the manifest into gradle. Now it synced fine :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.