45

I'm trying to Install Build Tools 26.0.2 and sync project

Failed to find build tools revision 26.0.2

I clicked "Install Build Tools 26.0.2 and sync project" but still failed ... Downloaded it from the external link .. but I don't know where I put it. So, What should I do? and THANKS

image1 image2

Mohamed Alaa
  • 471
  • 1
  • 4
  • 6
  • 2
    prolly you forgot to add google's repo in gradle ... asked many many times already – Selvin Dec 08 '17 at 20:51
  • Does this answer your question? [Failed to find Build Tools revision 23.0.1](https://stackoverflow.com/questions/36683726/failed-to-find-build-tools-revision-23-0-1) – Mahozad Mar 16 '21 at 08:04

11 Answers11

101

Android Studio is looking for build tools 26.0.2, but build tools 27.0.3 is already released for Android Oreo 8.1

I am not totally sure why, but Android Studio doesn't set the build tools in the gradle "app" file anymore. So here is how I fixed it. You get two options.

Method 1 - Install the missing build tools

1) Open the SDK manager by clicking on the icon in the top right of Android Studio. It looks like an android head in front of a download arrow. (Or go to File > Settings > Appearance & Behavior > System Settings > Android SDK)

2) Open SDK Tools tab

3) At the bottom-right, click "Show Package Details"

4) Find Android SDK Build-Tools and check the checkbox next to 26.0.2

5) Click apply in the bottom of the window

Method 2 - Use latest build tools

1) Follow instructions above

2) Uncheck all build tools besides 27.0.3 (the latest build tools at the time of writing)

Then you can define android build tools 27.0.3 in your gradle app file. To do this:

3) Make sure build tools 27.0.3 is installed by using the Android SDK manager (steps above).

4)Then find your build.gradle file. Use the navigation pane to the left of android studio. If it's closed click the icon that looks like the android studio icon to the far left of android studio (it should have text that is sideways, and normally says "1:project"). Then use the file tree to find the file [yourappname] > app > build.gradle

5) Open the file and it should have something along the lines of "apply plugin: 'com.android.application'" as the first line. Then add a new line under "compileSDKVersion" type in buildToolsVersion "27.0.3"

6) Then sync your project and you should be good to go!

Alex Lamson
  • 479
  • 5
  • 14
Anthony Alphabet
  • 1,175
  • 2
  • 8
  • 10
  • 1
    I created a new proyect, and this error tormented me for several minutes.I would never have realized that line was missing :( – UselesssCat Feb 15 '18 at 02:50
  • 1
    I've got a brand new project in Android Studio 3.0.1. I opened the Project pane and then opened build.gradle under "Gradle Scripts". It doesn't have `apply plugin` in the build.gradle file. First non-comment is `buildscript {`. I found the right file (app/build.gradle) by searching for compileSDKVersion in all files. – jcollum Mar 08 '18 at 00:34
  • 1
    I had this problem importing an old project. Instead of selecting the individual version, you have to go to Project Structure > Project and change the setting "Android Plugin Version". The project was 3.0.0 and it asked for build tools version 26. When I changed it to 3.3.1 it used the latest version. – neutromancer Feb 12 '19 at 16:41
6

I have solved this problem by simply downloading the package with a standard browser Firefox, Chrome, etc.

The link itself is taken from the error logs of the Android Studio

Unzip it into the local folder

C:\Path\To\AppData\Local\Android\Sdk\build-tools

And then rename the unzipped folder to 27.0.3

After that, just sync the build.gradle and voila! The problem is solved.

Also in the SDK Manager try to use on the SDK Update Sites Tab the following option:

  • Force https://... sources to be fetched using http://...
Georgy Ivanov
  • 39
  • 1
  • 4
5

i fix it! just like this
going to this local url: C:\Users\user\AppData\Local\Android\Sdk\build-tools, and manually delete the folder 26.0.2 and then going back to android studio and click on the link to download build 26.0.2
that fix it

June7
  • 19,874
  • 8
  • 24
  • 34
5

This worked for me. First click the icon at the top-right of the screen that looks like a cube with a blue arrow pointing down.

enter image description here

The default tab that is highlighted is the "SDK PLATFORMS". Check the API level 26. And click apply.

enter image description here

After the download and installation is done, click the icon at the top-right of the screen that looks like a cube with a blue arrow pointing down, click the second tab which is "SDK TOOLS" and click the "Show Package Details" at the bottom of the pop-up (above the "OK" button). A list of versions will show. Check the API version you need and click Apply. In this case, 26.0.2

enter image description here

Once you are done, build gradle again and it should be successful.

Junior
  • 1,007
  • 4
  • 16
  • 26
2

I got same error and fixed that. Please add this line below the compileSdkVersion into you gradle file.

android {
        compileSdkVersion 26
        buildToolsVersion "26.0.2"
}
1

https://dl.google.com/android/repository/build-tools_r26.0.2-windows.zip copy all files from [android-8.1.0] and move them into C:\Users\user\AppData\Local\Android\Sdk\build-tools\26.0.2

1

I encountered such an error, and I managed to solve it through the following procedure:

  1. open build.gradle(module)
  2. Change the compilesdkVersion to the latest one or the one you have installed- (mine was 31, and I change to 30)
  3. change the buildtoolversion to the latest one or the one you have installed- (mine was 31.0.0, and I changed to 30.0.0)
  4. change the targetSdkVersion to the latest one or the one that is in the compilesdkversion
  5. Sync and rebuild the project and the error will be gone.
wilfred
  • 139
  • 1
  • 4
1

OPEN ANDROID SDK--> SELECT SDK TOOLS--> SELECT PACKAGE DETAILS--> CHECK 26.0.0 (IF NOT CHECKED) THEN CLICK APPLY

enter image description here

Mohit Singh
  • 1,402
  • 1
  • 10
  • 19
1
  1. Download this file
  2. Extract it
  3. Copy all files from [android-8.1.0] and move them into C:\Users\user\AppData\Local\Android\Sdk\build-tools\26.0.2

You can manually replace that folder it worked.

Elikill58
  • 4,050
  • 24
  • 23
  • 45
0

i have same problem , my activity_main can't open because gradle project sync failed and i click "Install Build Tools 26.0.2 and sync project" and still failed

First , turn off kernel (file->seting->plugin->search kotlin then uncheck) Then your android studio will reopen automaticly

After this i click again "Install Build Tools 26.0.2 and sync project" and now it's works

If you wanna put from external link u can open : C:\Users\?\AppData\Local\Android\sdk\build-tools

image

Steven
  • 25
  • 2
  • 3
    do NOT do this, it will break Android Studio. To fix it you will have to edit the file disabled_plugins.txt and delete the line for Kotlin otherwise Android Studio will not start – user330844 Oct 30 '20 at 22:50
0

If you encounter this issue. simply go this website to download the required build tool for your project https://androidsdkmanager.azurewebsites.net/Buildtools

Step 2 >> Extract the downloaded file

Step 3 >> Locate the build-tools folder inside your SDK e.g (C:\Android\Sdk\build-tools)

Step 4 >> Paste the folder in the build-tools In my case, The default folder name was "Android-10" after I extracted the file but I change it to 29.0.2 since that's the issue I wanted to solve

Step 5 >> Rebuild your project :) .. Done!

enter image description here

Dayo Jaiye
  • 948
  • 1
  • 10
  • 17