我正在尝试在我的项目中导入Aliyun的httpdns包。但是当尝试将项目作为依赖项同步时,每次同步失败因为下载总是超时,我尝试直接在浏览器中通过终端下载它。我甚至尝试使用Android Studio代理 - >检查连接。它显示连接正常。
这是我的项目build.gradle文件,根据文档设置。
allprojects {
repositories {
jcenter()
google()
maven {
url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
}
}
}
这是我每次尝试同步项目时都会得到的。
org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'http://maven.aliyun.com/nexus/content/repositories/releases/com/aliyun/ams/alicloud-android-httpdns/1.1.3/alicloud-android-httpdns-1.1.3.pom'.
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
答案 0 :(得分:2)
通过将sock5代理替换为http代理来解决。
真的应该深入挖掘生活在中国的影子......