1. 程式人生 > >關於Android Studio:error:connection timed out:connect問題的解決方法

關於Android Studio:error:connection timed out:connect問題的解決方法

Android開發過程中,遇到過無數次這個錯誤,每次都是臨時去百度,感覺是時候寫一寫總結了。

這個錯誤一般在初次建立工程或者匯入別人的工程時出現。

關於這個錯誤,基本上都是因為gradle版本的問題,兩個原因:

(1)gradle版本不對,

(2)gradle版本因為翻牆網速太慢的原因(<10kb/s),一直無法下載下來,或者只下載了一部分。

針對以上原因,一般有以下解決辦法:

1. 檢視工程目錄下需要的gradle版本:本地專案程式碼資料夾\gradle\wrapper\gradle-wrapper.properties,用notepad++開啟,最後一行如下所示:

    distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

, gradle-2.14.1-all 即為版本號。

2. 檢視編譯工程用到的gradle版本 :C:\Users\xxx\.gradle\wrapper\dists\gradle-x.xx.x-all , 有些人可能有多個版本,gradle-x.xx.x-all即為版本號。

3. 這時你會看到,兩個版本號是不一樣的(如果一樣,就不會出現上述錯誤了,如果是一樣還是有錯誤,說明沒有下載完全,只下載了一部分),請參考以下兩個方法解決:

4.1 手動下載

      去 http://services.gradle.org/distributions 下載專案所需的gradle版本,然後拷貝到如下所示的目錄中:C:\Users\xxx\.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv ,然後不要做任何操作,重啟Android Studio即可。

4.2 修改版本號

      修改此目錄:distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 的gradle版本號為 此目錄:C:\Users\xxx\.gradle\wrapper\dists\gradle-x.xx.x-all 的gradle版本號,重啟Android Studio。

ps :對於4.2辦法,我個人試過很多次,都是沒有解決問題,但網上一直有人說可以解決,各位看官優先使用4.1的方法吧。

最後,建議Android開發可以弄一個VPN賬號,會方便很多,另外,和別人共用一個VPN賬號也是可以的。



相關推薦

Android Studio Error:Connection timed out: connect.解決方案

    小編把Android Studio升級到了2.0版本,但是遇到了這樣的錯誤: Error:Connection timed out: connect. If you are behind an

關於Android Studio:error:connection timed out:connect問題的解決方法

Android開發過程中,遇到過無數次這個錯誤,每次都是臨時去百度,感覺是時候寫一寫總結了。 這個錯誤一般在初次建立工程或者匯入別人的工程時出現。 關於這個錯誤,基本上都是因為gradle版本的問題,兩個原因: (1)gradle版本不對, (2)gradle版本因為翻牆網

Android Studio 出現Error:Connection timed out: connect.解決方案

錯誤發生在構建Gradle的過程中正在下載gradle.zip檔案的時候 這個時候檢查下開啟專案裡gradle\wrapper\gradle-wrapper.properties這個檔案的gradle

Connection timed out: connect 解決方法

今天本來程式好好的。。。不知道怎麼搞的。。突然就報錯誤。。。資料庫一切正常,連的是本機的庫,網上說有可能是防火牆的問題,我防火牆關了。。網線也是好的。後來受別人啟發。。。把別的正常系統裡面的配置檔案複製過來。。。修改一下。。OK了。。沒問題了。。。我估計可能是因為經過SVN版

Android Studio開發中gradle connection timed out錯誤解決方法

用Android Studio匯入一個專案時,用Gradle構建過程中報gradle connection timed out錯誤,估計是下載gradle.zip檔案時訪問不到,應該是被牆了。可以下載

解決Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy

android 2.0之後,出現該問題的原因是as訪問https://services.gradle.org/distributions/gradle-xxx.zip下失敗 如下: D:\Share_L\MyApplication>gradlew Downloadin

AndroidStudio解決Error:Connection timed out: connect. If you are behind an HTTP proxy, please configu

androidStudio中匯入工程報:Error:Connection timed out: connect. If you are behind an HTTP proxy, please configu,解決方法如下: 第一步:檢視可以正常開啟的安卓專案 (1)檢視工

Android】TensorFlow出現Connect to storage.googleapis.com:443 ......Connection timed out: connect解決辦法

TensorFlow執行的時候會報以下異常: Error:Execution failed for task ‘:downloadFile’. org.apache.http.conn.HttpHostConnectException: Connect

Connection timed out: connect 解決辦法

問題闡述: 由於需要在Linux上進行專案的測試,將專案放在Linux服務上,通過地址和埠號進行連線,但會出現java.net.ConnectException: Connection timed out: connect 的錯誤。 如圖: 嘗試解決辦法: Linux和

Androidgradle報錯之:Error:Connection timed out: connect

使用環境: 週一,大吉大利! 早上距離上班早了33分鐘,很開心趕緊開啟電腦->AS,結果,報錯Error:Connection timed out: connect 然後各種提示各種處理 比如 1 修改gradle的zip網址,換成國內的,讓它自動下載        

Gradle升級,Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure

Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy se

Putty或MobaXTerm連線VMware虛擬機器 報Network error: Connection timed out解決方案

當出現無法連線的問題時, 我們要先對可能出現的問題進行梳理, 然後進行排查, 以下我先整理一些可能出現問題的地方: 1. 通過 ping 檢視兩臺終端是否均有聯網 windows下通過控制檯 cmd 進入命令列, 輸入  ping www.baidu.com  檢視返回包的結果.

Android Studio Gradle sync failed: Connection timed out: connect解決辦法)

             因為更新Android Studio到最新版,我採用下載最新版重新安裝的方式,遇到最大的問題就是Gradle sync failed: Connection timed out: connect ,在網上嘗試了各種辦法都得不到解決,這裡記錄下大佬教我

Android Studio:Gradle project refresh failed. Connection timed out: connect.

事件 換了個電腦,Android Studio拷過來,重新配置後,開啟已有的專案,報錯: Gradle project refresh failed. Connection timed out:

Dom4J讀取XML檔案時出現的connection timed out:connect Nested exception異常解決方法

最近在專案中實現一個雙資料庫的動態讀取樹形選單功能,通過了Dom4J來實現,執行過程中出現以下問題: 在本論壇查到原因為 dom4j會去拿DTD增加那些DOCTYPE的預設屬性,因此加入下面一段話即可。 解決辦法連結http://topic.csdn.ne

java.net.ConnectException: Connection timed out: connect原因及解決 java設定代理http請求

今天用URLConnection進行http請求時,返回錯誤如下: java.net.ConnectException: Connection timed out: connect  at java.net.PlainSocketImpl.socketConnect(Nat

Gradle sync failed: Connection timed out: connect

wrapper oid https image AD 圖片 替換 syn 下載 打開AS的project試圖,找到gradle目錄下的wrapper下面的gradle wrapper.properities找到: distributionUrl=https\://servi

Caused by: java.net.ConnectException: Connection timed out: connect

spring boot專案整合mybatis時連線資料庫報錯 Caused by: java.net.ConnectException: Connection timed out: connect 我的是因為linux上的防火牆及3306埠沒開放 參考: https://blog

putty連線centos7 Network error:connection timed out

首先說明一下,centos7系統下的開機服務不再在/etc/inittab的管理之下了,centos7使用systemd模組管理系統的服務, 所有的服務檔案都改為/etc/systemd/system的.service檔案或者/usr/lib/systemd的.service檔案。對應的啟

connection.getOutputStream() 報java.net.ConnectException: Connection timed out: connect

摘自stackoverflow Connection timeouts (assuming a local network and several client machines) typically result from a) some kind of firewall on the w