Unity Android构建报错:版本切换后gradle依赖问题无法解决
Unity Android构建失败:无法解析com.android.tools.build:gradle:6.1.1
我在使用Unity 2021.3.7f1开发Android游戏时遇到构建问题:之前为解决APK权限问题,临时将Unity版本切换到2022.3.29f1,切回原版本后就无法完成构建,一直报找不到gradle依赖的错误。
我已经尝试过以下操作,但都没有解决问题:
- 删除gradle.properties文件中的r8相关条目
- 手动修改build.gradle文件,把gradle引用版本从7.1.2改成6.1.1
报错详情如下:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':launcher'. > Could not resolve all artifacts for configuration ':launcher:classpath'. > Could not find com.android.tools.build:gradle:6.1.1. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.1.1/gradle-6.1.1.pom - https://jcenter.bintray.com/com/android/tools/build/gradle/6.1.1/gradle-6.1.1.pom Required by: project :launcher * 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 1s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
我可以补充更多项目或环境细节,恳请大家帮忙解决。
内容的提问来源于stack exchange,提问作者Matt Radin
相关产品推荐
相关产品推荐

