Gradle同步失败:找不到构建工具修订版24.0.0 rc1 [英] Gradle sync failed: failed to find Build Tools revision 24.0.0 rc1

查看:114
本文介绍了Gradle同步失败:找不到构建工具修订版24.0.0 rc1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我在Android Studio中设置新项目时遇到了错误.创建空白项目后,日志立即显示"Gradle sync failed:找不到Build Tools版本24.0.0 rc1."

As of today I've been running into an error setting up new projects in Android Studio. Right after creating a blank project the log mentions "Gradle sync failed: failed to find Build Tools revision 24.0.0 rc1."

首先,我上网查看如何解决此问题,并遇到了

First I looked online to see how to resolve this and came across this similar question, and followed the solution given (setting the build tools version in the module settings). However, this results in Android Studio telling me that the method "android()" cannot be found and "The project 'TestBlankApplication' may be using a version of Gradle that does not contain the method."

此外,SDK Manager通知我我已经安装了构建工具24 rc1.所以我不知道为什么Android Studio无法找到它.

Additionally, the SDK Manager informs me that I have Build-tools 24 rc1 installed. So I do not know why Android Studio cannot find it.

SDK Manager的屏幕截图,显示已安装24个rc1:

有人知道如何解决吗?谢谢.

Does anyone know how this can be resolved? Thank you.

推荐答案

为什么会出现此错误:

下载Android Studio时,它没有针对不同android版本的构建工具.这也没有意义,因为有多种版本的构建工具,每个构建工具将占用您硬盘上的数百兆字节.这就是为什么Android Studio安装包为1 GB,而具有所有构建工具的Xcode为6 GB的原因

Why you got this error:

Android studio does not come with build tools for different android versions when you download it. It also does not make sense since there are multiple versions of build tools and each of them will take hundreds of megabytes on your hard drive. This is why Android Studio installation package is 1 GB while Xcode, which has all the build tools, is 6 GB

当您在build.gradle文件中选择特定的构建版本时,您的android studio可能会或可能未安装该版本的构建工具.如果没有,您将看到该错误的抱怨.

When you choose a specific build version in the build.gradle file, your android studio may or may not have that version of build tool installed. And if not, you will see the error complaining about it.

您只需要安装build.gradle中提到的特定版本的构建工具,如下所示:

You just need to install the specific version of build tool mentioned in build.gradle like this:

  1. 点击 文件 > 设置 (在Mac上为 Android Studio > 首选项 ) 打开设置对话框.
  2. 转到 外观&行为 > 系统设置 > Android SDK (或者 只需在搜索栏上搜索 Android SDK )
  3. 转到 SDK工具 标签>选中 显示软件包详细信息 复选框
  4. 选择特定版本的构建工具,然后点击 应用 按钮
  5. 安装后,同步项目
  1. Click File > Settings (on a Mac, Android Studio > Preferences) to open the Settings dialog.
  2. Go to Appearance & Behavior > System Settings > Android SDK (Or simply search for Android SDK on the search bar)
  3. Go to SDK Tools tab > Check the Show Package Details check box
  4. Select the specific version of the build tool and click on the Apply button
  5. After the installation, sync the project

Demos

(我选择一个不同的版本只是为了向您展示如何通过应用"按钮应用更改:))

Demos

(I choose a different version just to show you how to apply the changes by that apply button :) )

然后同步项目.错误现在消失了!

And then sync the project. The error is gone now!

这篇关于Gradle同步失败:找不到构建工具修订版24.0.0 rc1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆