14

I wanted to Setting up android studio, i have installed the latest version(3.1.0) of it and i downloaded and installed the latest version of gradle(4.6) and created a new object. but gradle project sync failed. and shown up the error :

Could not find builder.jar (com.android.tools.build:builder:3.1.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.0/builder-3.1.0.jar

screenshot

I Couldn't find such problem with the others.

  1. is it related to android sdk or gradle version?
  2. is there any solution to download it manually and place it in the location??if it's possible , where is the location ,that i can put the builder-3.1.0.jar file.
Pang
  • 9,564
  • 146
  • 81
  • 122
Salim13i
  • 159
  • 1
  • 1
  • 12

7 Answers7

28

Go to File>Setting>Build,Execution,Deployment>Gradle>Android Studio>> and Check mark this:: Enable Embedded repository and Click Ok. Then, Rebuild the Project.

or

go to Terminal and type "gradlew cleanBuildCache" to clear the cache. The cache is in USERNAME.ANDROID\BUILD CACHE Directory.

And Rebuild.

Hamed Ahmadi
  • 404
  • 4
  • 8
  • sorry cause late answer i uninstalled the android studio & installed the 3.1.1 version & and i have a new error : Could not connect to server [fc3d9512-540e-47b4-9cb0-8d3b0c134fbe port:5736, addresses:[/127.0.0.1]]. Tried addresses: [/127.0.0.1]. – Salim13i Apr 14 '18 at 08:24
  • it's not related to conection because i can update sdk from sdk manager but when i want to sync gradle this message was displayed – Salim13i Apr 14 '18 at 08:36
  • i tried your solution. and it works. thank you so much – Salim13i Apr 14 '18 at 13:07
  • where is this section in AS 4.1.1? – roghayeh hosseini Dec 27 '20 at 05:12
6

Accepted answer did not work for me, so I changed the class path line in gradle (project : project name) and issue is gone.

classpath 'com.android.tools.build:gradle:3.1.2'
Dezso Gabos
  • 2,297
  • 5
  • 21
  • 29
Ramkesh Yadav
  • 987
  • 2
  • 11
  • 16
6

Try deleting ~/.gradle folder and building the project again. Gradle will download that.

Dezso Gabos
  • 2,297
  • 5
  • 21
  • 29
ben
  • 740
  • 7
  • 16
2

I have tried all of the suggestions and none of them worked! if you are facing the same issue i suggest you to do what solved my problem , i have found out the problem may caused because:

most likely at one time this dependency version was available, and so it’s now available on your Mac/PC in the filesystem (cache), and Gradle won’t try to download it (as it’s already downloaded). But then the version was removed / is no longer available, so it will no longer work on any new Mac/PC (as the dependency version can’t be downloaded).

hopefully if you have a backup before this problem happen these steps might help you to fix this issue

1) Backup or push the file you have changed to git (I suggest just your code files not anything related to gradles or android files)

2) delete C:\Users\ (your User)\ .gradle\caches

3) Do a clean git clone of the repository, into a new directory

4) Open new copy of your project with Android Studio and let Android studio sync gradles again

Shayan Moghadam
  • 1,860
  • 2
  • 10
  • 19
1

Check the version of Android Studio you are using...i was Android Studio 3.1 when it gave me the problem....i downgraded my Android Studio version to 3.0.1 and the problem solved.

Rajas47Ashtikar
  • 583
  • 2
  • 6
  • 11
1

I battled with the same problem for a very long time. But I was able to resolve it. You can try this: Go FIle > Settings > Build, Execution, Deployment> Build Tools > Gradle then check the option Offline Work . You will notice that it points to a local gradle directory on your computer i.e C:Users/User_name/.gradle. Click Apply then OK. Run your project again, it should work. Below is a screenshot:Screenshot of the Fix

edauda
  • 11
  • 2
0

go to SDK manager and download other SDK platform

roghayeh hosseini
  • 676
  • 1
  • 8
  • 21