If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.(AS报错)
2016-11-19 15:19
2695 查看
积少成多,全靠自觉。
在使用Androidstdio开发中,我们导入一个AS的项目,发现报了一个错误:Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.Consult IDE log for more details (Help |
Show Log)。
案例:
我的项目是用Android Studio1.5创建的,然后用android studio2.2.2打开,然后就一直出现这个问题,然后我还以为是我的网的问题,后来发现不是;
然后我又安装了1.5版的android studio,然后在打开项目,然后就问题就没有了,项目完美运行
问题可能是:高版本的android studio项目,用低版本的打开,可能gradle的设置会出现一些问题。
***分析错误原因:
导入的AS项目是在android2.1版本下gradle的,我现在使用最新版本的Androidstudio2.2.2,AS的gradle版本不同(简单的说就是androidstdio中gradle版本需要对应AS版本),所以配置文件中gradle版本号(classpath)和gradle版本下载路径(distributionUrl)要和AS版本匹配,而且classpath和distributionUrl也要匹配对应
解决方案:
1.指定gradle为本地已下载的gradle 如gradle-2.2(如果不知道自己androidstdio的gradle版本,可以查看之前的android项目查看,主要是查看1.工程根目录下的build.gradle2gradle->wrapper->gradle-wrapper.properties)
2.修改工程根目录下的build.gradle 中的 classpath 为 指定gradle版本以支持 上述中gradle home指定的gradle版本号 如:gradle-2.2.2 对应的 classpath 如下:
classpath 'com.android.tools.build:gradle:2.2.2'
3.在gradle->wrapper->gradle-wrapper.properties 将distributionUrl改为对应的gradle版本下载路径,如下:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
4.Sync Project with Gradle Files:(如下图所示)
工程复活
在使用Androidstdio开发中,我们导入一个AS的项目,发现报了一个错误:Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.Consult IDE log for more details (Help |
Show Log)。
案例:
我的项目是用Android Studio1.5创建的,然后用android studio2.2.2打开,然后就一直出现这个问题,然后我还以为是我的网的问题,后来发现不是;
然后我又安装了1.5版的android studio,然后在打开项目,然后就问题就没有了,项目完美运行
问题可能是:高版本的android studio项目,用低版本的打开,可能gradle的设置会出现一些问题。
***分析错误原因:
导入的AS项目是在android2.1版本下gradle的,我现在使用最新版本的Androidstudio2.2.2,AS的gradle版本不同(简单的说就是androidstdio中gradle版本需要对应AS版本),所以配置文件中gradle版本号(classpath)和gradle版本下载路径(distributionUrl)要和AS版本匹配,而且classpath和distributionUrl也要匹配对应
解决方案:
1.指定gradle为本地已下载的gradle 如gradle-2.2(如果不知道自己androidstdio的gradle版本,可以查看之前的android项目查看,主要是查看1.工程根目录下的build.gradle2gradle->wrapper->gradle-wrapper.properties)
2.修改工程根目录下的build.gradle 中的 classpath 为 指定gradle版本以支持 上述中gradle home指定的gradle版本号 如:gradle-2.2.2 对应的 classpath 如下:
classpath 'com.android.tools.build:gradle:2.2.2'
3.在gradle->wrapper->gradle-wrapper.properties 将distributionUrl改为对应的gradle版本下载路径,如下:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
4.Sync Project with Gradle Files:(如下图所示)
工程复活
相关文章推荐
- If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
- 【Android Studio错误】 If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
- Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy...
- 完美解决Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- 异常Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- 使用AS遇到Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the pro
- 解决:Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- 解决:Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- If you are behind an HTTP proxy, please configure the proxy set
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- 解决:Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy set
- android stuido 报 If you are behind an HTTP proxy, please configure the proxy set
- Android 开发 Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure th