Failed to build project with Android studio

GradleAndroid Studio

Gradle Problem Overview


Can anyone tell me why I'm getting this error with AndroidStudio?

Execution failed for task ':sampleapp:preBuild'.
> Build Tools Revision 19.0.0+ is required.

I have installed Android Build-tools 19.0.1 from the Android SDK manager

Gradle Solutions


Solution 1 - Gradle

Check all your build.gradle files whether they are using the 19.0.x version or not.

buildToolsVersion will be defined under the android tag inside the build.gradle file, like this:

android {
     compileSdkVersion 19
     buildToolsVersion '19.0.3'

     // Other Configuration
}

You can find a list of versions for the Android Build Tools here as well as in the SDK Manager.

Solution 2 - Gradle

Go to Window->Android SDK Manager and run it

You will see Android Build-Tools version installed...

Change build.gradle to reflect the installed version of build tools

This worked for me

OR

Install the version which is shown in error

Solution 3 - Gradle

This seemed to work for me. I had to update the Default settings then restart the IDE:

  1. File->Other Settings->Default Project Structure
  2. Under Project Settings: Project, set Project SDK as Android SDK.
  3. Click Edit button
  4. For Android SDK, set Build target to Android 4.4.2
  5. Click Ok.
  6. Restart IDE
  7. Then rebuild. Seemed to work after that..

This is assuming you've already installed Android-19 and still having difficulties.

Solution 4 - Gradle

If you have installed the required version of the build tools and it does not work:

Eclipse and the Android Studio likely use two different copies of the SDK, and you have updated the other copy.

Solution 5 - Gradle

Edit your project level build.gradle file and set gradle version to the latest version now it is 3.2.1

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'

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

Solution 6 - Gradle

It's helpful to remember that you will have build.gradle files for each module in your Android Studio Project.

I kept hitting my head against the wall - "Where the heck is that line everyone's telling me to change?!" - until I looked in the ~/dev/AndroidProjects/xxprojectnamexx/app folder and looked at the build.gradle file there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKarlisView Question on Stackoverflow
Solution 1 - GradlePiyush AgarwalView Answer on Stackoverflow
Solution 2 - Gradleuser3013143View Answer on Stackoverflow
Solution 3 - GradleRayView Answer on Stackoverflow
Solution 4 - Gradle18446744073709551615View Answer on Stackoverflow
Solution 5 - GradleEdalat FeiziView Answer on Stackoverflow
Solution 6 - GradleAndroid AggieView Answer on Stackoverflow