错误记录Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )相关的知识,希望对你有一定的参考价值。





一、报错信息



Executing tasks: [:dex_demo:assembleDebug, :app:assembleDebug] in project Y:\\002_WorkSpace\\001_AS\\ClassLoader_Demo

AGPBI: "kind":"warning","text":"Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.\\nThis repository is deprecated and it will be shut down in the future.\\nSee http://developer.android.com/r/tools/jcenter-end-of-service for more information.\\nCurrently detected usages in: root project 'ClassLoader_Demo', project ':app', project ':dex_demo'","sources":[]
Build-tool 31.0.0 is missing DX at Y:\\001_DevelopTools\\002_Android_SDK\\build-tools\\31.0.0\\dx.bat
Build-tool 31.0.0 is missing DX at Y:\\001_DevelopTools\\002_Android_SDK\\build-tools\\31.0.0\\dx.bat

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':dex_demo:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 33s





二、解决方案



创建 Project 工程时 , 自动创建的 Module 其 build.gradle 为 如下属性 ,

android 
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

创建 Module 时 , 生成的 build.gradle 为 如下属性 ,

android 
    compileSdkVersion 30
    buildToolsVersion "31.0.0"

将 buildToolsVersion 的版本 , 由 31.0.0 31.0.0 31.0.0 修改为 30.0.3 30.0.3 30.0.3 即可 ;

android 
    compileSdkVersion 30
    //buildToolsVersion "31.0.0"
    buildToolsVersion "30.0.3"

修改后 , 编译完成 ;


备选方案 : 按照

Remove and install again using the SDK Manager.

提示 , 卸载 Build-tool 31.0.0 并重新安装 ;

先卸载 , 再安装 ;

以上是关于错误记录Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译时 Kotlin 代码编译报错 ( 升级支持库时处理 @NonNull 参数 )

错误记录Android Studio 编译报错 ( Invalid main APK outputs : EarlySyncBuildOutput )

错误记录Android Studio 编译报错 ( Invalid Gradle JDK configuration found )

错误记录Android Studio 编译报错 ( VirtualApp 编译 NDK 报错 | Error:A problem occurred configuring project ‘: )(代