windows Android Studio Gradle 构建错误:读取超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50605734/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio Gradle Build Error: Read Time Out
提问by Daniel W.
I have the latest Android Studio IDE installed on my Windows 10 laptop, and it was working fine until my windows operating system made a huge automatic update.
我在我的 Windows 10 笔记本电脑上安装了最新的 Android Studio IDE,它运行良好,直到我的 Windows 操作系统进行了巨大的自动更新。
Now, when start my Android Studio IDE, I get the following error and it doesn't build.
现在,当启动我的 Android Studio IDE 时,我收到以下错误并且它没有构建。
Gradle sync failed: Read timed out Consult IDE log for more details (Help | Show Log) (3m 34s 195ms)
Gradle 同步失败:读取超时请查阅 IDE 日志以获取更多详细信息(帮助 | 显示日志)(3m 34s 195ms)
I need help on this.
我需要这方面的帮助。
回答by Fruit
I encounter this error "Read Time Out", and I simply choose menu item: File-> Invalidate Caches / Restart...to fixed it.
我遇到了这个错误“读取超时”,我只需选择菜单项:文件-> 使缓存无效/重新启动...来修复它。
[UPDATE]
[更新]
I just encounter this error for second time, this time Invalidate Caches / Restart...not able to fix it, but then I try close the android Studio, killall -9 java
to ensure all java process has been terminated, then relaunch Android Studio, no more error.
我刚刚第二次遇到这个错误,这次无效缓存/重新启动......无法修复它,但后来我尝试关闭android Studio,killall -9 java
以确保所有java进程都已终止,然后重新启动Android Studio,没有更多错误.
[UPDATE 2]I just encounter this error and I fixed it by replug the phone cable and rerun.
[更新 2]我刚遇到这个错误,我通过重新插入电话线并重新运行来修复它。
回答by jhonkaman
回答by Weekend
For Chinese users who often use a proxy to download dependency jars, the cause is often proxy settings.
对于经常使用代理下载依赖jar包的 CN 用户来说,原因往往是代理设置。
We should check multiple places if the proxy is correctly configured.
如果代理配置正确,我们应该检查多个地方。
- Android Studio Settings - Appearance & Behavior - System Settings - HTTP Proxy
- ${project_root}/gradle.properties
- ~/.gradle/gradle.properties
- Android Studio 设置 - 外观和行为 - 系统设置 - HTTP 代理
- ${project_root}/gradle.properties
- ~/.gradle/gradle.properties
In my case, I somehow once configured an HTTP proxy in ~/.gradle/gradle.properties
, which was forgotten later. Then when I dealt with a SOCKS5 proxy in IDE Settings and project-level gradle.properties
, things always run into trouble. Finally, deleting invalid proxy settings in ~/.gradle/gradle.properties
save my day.
就我而言,我曾经以某种方式在 中配置了一个 HTTP 代理~/.gradle/gradle.properties
,后来忘记了。然后当我在 IDE Settings 和 project-level 处理 SOCKS5 代理时gradle.properties
,事情总是遇到麻烦。最后,在~/.gradle/gradle.properties
save my day 中删除无效的代理设置。
回答by Arpit Aggarwal
Editing global gradle.properties
with the following line was the fix for me:
gradle.properties
使用以下行编辑全局对我来说是修复:
org.gradle.jvmargs=-Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.http.socketTimeout=120000
回答by e.hadid
I just removed
我刚删除
include ':app'
包括':app'
from setting.gradle
and then sync project
从setting.gradle
然后同步项目
it will fails again
它会再次失败
then write it back an re-sync and then error gone and will start downloading.
然后将其写回重新同步,然后错误消失并开始下载。
回答by Elynad
A simple Clean Project
+ Rebuild Project
worked for me
一个简单的Clean Project
+Rebuild Project
对我有用
回答by Gowtham Subramaniam
In my case, it was a firewall issue. After adding Android Studio to its whitelist everything is working fine.
就我而言,这是防火墙问题。将 Android Studio 添加到其白名单后,一切正常。
回答by Ambilpura Sunil Kumar
Simple Answer:
简单回答:
- Check the Internet Connection - it should not fluctuate while building the project
- File-->>Sync Project with Gradle File
- Build>> Clean Project Or Rebuild Project.
- 检查 Internet 连接 - 在构建项目时它不应波动
- 文件-->>将项目与 Gradle 文件同步
- 构建>>清理项目或重建项目。