Android Studio Flamingo版本Gradle同步与构建耗时过长求助
针对Gradle同步/构建耗时过长的解决方案
- 清理Gradle代理残留与缓存
- 打开项目根目录的
gradle.properties文件,删除或注释所有以systemProp.http.proxy、systemProp.https.proxy开头的配置行 - 找到本地Gradle缓存目录(Windows默认路径:
C:\Users\[你的用户名]\.gradle),删除其中的caches和wrapper文件夹,重启Android Studio后重新同步
- 打开项目根目录的
- 彻底清除Android Studio代理配置
- 进入
Settings->Appearance and Behavior->System Settings->HTTP Proxy,选择No proxy,点击应用并重启AS - 检查AS配置文件:找到
C:\Users\[你的用户名]\.AndroidStudioFlamingo\config\idea.properties(或AS安装目录下bin文件夹内的同文件),删除所有idea.http.proxy.*相关配置项
- 进入
- 替换仓库源为稳定镜像
打开项目根目录的build.gradle(Project级),将仓库配置替换为国内镜像,示例:buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } } // ... 其他配置 } allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } } } - 开启Gradle加速选项
进入Settings->Build, Execution, Deployment->Build Tools->Gradle,勾选以下选项:- Offline work(需确保之前已成功同步过一次,有本地缓存)
- Parallel project execution
- Configure on demand
- 排查系统级代理残留
- 打开系统环境变量(右键此电脑→属性→高级系统设置→环境变量),删除
HTTP_PROXY、HTTPS_PROXY相关变量 - 打开注册表(Win+R输入
regedit),定位到HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings,确认ProxyEnable值为0,ProxyServer为空
- 打开系统环境变量(右键此电脑→属性→高级系统设置→环境变量),删除
内容的提问来源于stack exchange,提问作者Vishnu Satheesh
相关产品推荐
相关产品推荐

