title: configuring project ':app' failed to find Build Tools revision
body: <p>My android gradle build fails with a helpful error message</p>
  
  <pre><code>$ gradle
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; failed to find Build Tools revision 24.4.1
  </code></pre>
  
  <p>I looked at the SDK version that Android Studio thinks I have installed.</p>
  
  <p><a href="https://i.stack.imgur.com/osbRb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/osbRb.png" alt="enter image description here"></a></p>
  
  <p>It reports I have 24.4.1 installed, which agrees with my <code>build.gradle</code> file. </p>
  
  <p>Also, I have tried installing the sdk with <code>./android list sdk -a; ./android update sdk -a -u -t 1</code> but still the failure persists.</p>
  
  <p>I even tried putting a bogus <code>local.properties</code> file</p>
  
  <pre><code>sdk.dir=/home/admin/DEADBEEF
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>$ gradle
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; The SDK directory '/home/admin/DEADBEEF' does not exist.
  </code></pre>
  
  <p>Also, the stacktrace doesn't seem to be much help because I didn't find this source file. So now I've started digging through the <a href="https://android.googlesource.com/platform/tools/base/" rel="noreferrer">googlesource</a> for <a href="https://android.googlesource.com/platform/tools/base/+/master/build-system/builder/src/main/java/com/android/builder/sdk/DefaultSdkLoader.java" rel="noreferrer">DefaultSdkLoader</a></p>
  
  <pre><code>$ gradle --stacktrace
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; failed to find Build Tools revision 24.4.1
  
  * Try:
  Run with --info or --debug option to get more log output.
  
  * Exception is:
  org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
          at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
          at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
          at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
          at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
          at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
          at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
          at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
          at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
          at org.gradle.internal.Factories$1.create(Factories.java:22)
          at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
          at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
          at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
          at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
          at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
          at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
          at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
          at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
          at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
          at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
          at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
          at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
          at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
          at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
          at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
          at org.gradle.util.Swapper.swap(Swapper.java:38)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
          at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
          at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
          at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
          at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
  Caused by: java.lang.IllegalStateException: failed to find Build Tools revision 24.4.1
          at com.android.builder.sdk.DefaultSdkLoader.getTargetInfo(DefaultSdkLoader.java:93)
          at com.android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.java:89)
          at com.android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.java:673)
          at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:610)
          at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:566)
          at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:563)
          at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
          at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
          at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:562)
          at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:559)
          at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
          at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
          at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
          at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
          at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
          at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
          at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
          at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
          ... 52 more
  </code></pre>
  
  <p>Before <code>DefaultSdkLoader</code> can use a build tool to compile the project, the </p>
  
  <pre><code>com.android.sdklib.repository.local.LocalSdk#scanBuildTools
  </code></pre>
  
  <p>is called using your SDK directory. A new <code>BuildToolInfo</code> is created, which uses <code>PKG_BUILD_TOOLS</code> type to find build tools. So, I just looked in my build-tools folder in my android SDK and, lo! There are no build tools for 24.4.1</p>