Unity项目打包APK失败求助:Build Tools 33.0.0损坏问题
问题描述
Unity 2020.3.21 版本项目打包APK失败,因需提交Google Play Store更新,当前使用API Level 31。每次打包均触发「Build Tools 33.0.0损坏」报错,已通过Android Studio重新安装该版本但问题依旧。
报错信息
第一次报错日志:
FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl'. > Installed Build Tools revision 33.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 -
第二次报错日志:
Could not determine the dependencies of task ':unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl'. > Installed Build Tools revision 33.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 17s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ]
解决方案
手动清理Build Tools残留文件
- 关闭Unity和Android Studio
- 找到Android SDK的Build Tools目录:Windows路径一般是
C:\Users\[你的用户名]\AppData\Local\Android\Sdk\build-tools\33.0.0,Mac路径一般是~/Library/Android/sdk/build-tools/33.0.0 - 彻底删除整个
33.0.0文件夹 - 重新打开Android Studio,通过SDK Manager重新安装Build Tools 33.0.0
指定Unity使用的Build Tools版本
- 在Unity编辑器中打开
Edit > Project Settings > Player > Android > Publishing Settings - 展开
Build选项,找到Build Tools Version,手动选择33.0.0(若下拉列表无该选项,点击Download重新下载)
- 在Unity编辑器中打开
排查Google Mobile Ads插件兼容性
- 将项目中的Google Mobile Ads插件更新至兼容Unity 2020.3的最新版本
- 若更新后仍报错,可暂时回退到Build Tools 32.0.0(API Level 31可搭配该版本打包)
清理Unity与Gradle缓存
- 在Unity中点击
File > Build Settings > Android > Clean Build - 删除Gradle缓存目录:Windows为
C:\Users\[你的用户名]\.gradle\caches,Mac为~/.gradle/caches - 重新尝试打包
- 在Unity中点击
内容的提问来源于stack exchange,提问作者Zain
相关产品推荐
相关产品推荐

