gradle 官网:http://services.gradle.org/distributions/

出现 Gradle sync failed: Operation timed out (Connection timed out) 错误的原因大致是因为 https 的问题,所以我们直接修改项目内 gradle 配置为 http 协议下载就好了,配置文件:gradle-wrapper.properties

将其中的 distributionUrl 参数修改为 http 协议的下载链接,如我的原配置文件:

#Thu Apr 04 21:51:28 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

改为:

#Thu Apr 04 21:51:28 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-4.10.1-all.zip

是不是很简单,快去试试吧…