Android Studio 错误“已安装的构建工具修订版 31.0.0 已损坏" [英] Android Studio error "Installed Build Tools revision 31.0.0 is corrupted"

查看:54
本文介绍了Android Studio 错误“已安装的构建工具修订版 31.0.0 已损坏"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Android Studio 4.2.2.我创建了一个新项目,但没有在启动代码中添加任何内容,每当我单击构建或运行时,我都会收到此错误:

I'm on Android Studio 4.2.2. I created a new project and haven't added anything to the starter code and whenever I click build or run, I get this error:

安装的构建工具修订版 31.0.0 已损坏.使用 SDK 管理器删除并重新安装.

Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

我查看了其他帖子的建议,但这些解决方案都没有奏效.这是我尝试过的:

I've looked at other posts' suggestions, but neither of those solutions worked. Here's what I've tried:

  1. SDK Manager → SDK Tools → 勾选显示包详细信息",取消勾选 31.0.0,然后点击应用";→ 卸载 31.0.0 → 检查 31.0.0 并重新安装
  2. 在 SDK Manager 中,取消选择 31.0.0 并尝试安装旧版本(例如,我尝试过 30.0.3)并更新buildToolsVersion";在 build.gradle 到已安装的版本
  3. 转到项目结构属性并确认为构建工具版本"选择了 31.0.0;和编译后的 SDK 版本"
  4. 手动删除 build-tools 文件夹中的东西;即,rm -rf/path/to/android/sdk/build-tools/31.0.0(它不像其他一些帖子描述的那样以-rc"结尾)
  5. 重启 Android Studio
  6. 重新安装 Android Studio
  1. SDK Manager → SDK Tools → check "Show package details", uncheck 31.0.0, and click "Apply" → Uninstall 31.0.0 → check 31.0.0 and reinstall it
  2. In SDK Manager, deselect 31.0.0 and try installing an older version (e.g., I've tried 30.0.3) and update "buildToolsVersion" in build.gradle to the installed version
  3. Went to Project StructureProperties and verified that 31.0.0 is selected for "Build Tools Version" and "Compiled SDK Version"
  4. Manually remove the stuff in the build-tools folder; i.e., rm -rf /path/to/android/sdk/build-tools/31.0.0 (it doesn't end in "-rc" like some other posts have described)
  5. Restart Android Studio
  6. Reinstall Android Studio

我是一个 Android 菜鸟,只是想建立一个 hello world 项目,这真的不应该这么难.

I'm an Android noob just trying to set up a hello world project, and it really shouldn't be this hard.

推荐答案

遇到了同样的问题,修改了几行就解决了.

The same problem was encountered and solved with a few line changes.

检查项目代码面板,然后转到Gradle Scriptsbuild.gradle 文件,

Check the Project code panel, and go to Gradle Scriptsbuild.gradle file,

  1. 将三个位置从 31 改为 30:compileSdkVersionbuildToolsVersiontargetSdkVersion
  2. 您会注意到修改后的线路上发生了灯泡撞击.单击并选择同步 [到版本 30].Android Studio 将自动下载 BuildTool V30 并更改项目设置.

现在运行应用程序.它对我有用.

Now run the app. It works for me.

这篇关于Android Studio 错误“已安装的构建工具修订版 31.0.0 已损坏"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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