Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

Android Studio 更新跳 Connection failed?Windows 與 Mac 的解法差在這個檔案

編輯:更多教學

Android Studio 檢查更新時跳出 Connection failed,是不少人遇過的狀況。網路上流傳的解法大同小異,但有些說法不夠清楚,這裡把兩個平台的差異講明白。

Windows

在安裝目錄的「/bin/studio.exe.vmoptions」檔尾端補上這幾行:

-Djava.net.preferIPv4Stack=true
-Didea.updates.url=https://dl.google.com/android/studio/patches/updates.xml
-Didea.patches.url=https://dl.google.com/android/studio/patches/

要留意的是,64 位元系統要改的是「/bin/studio64.exe.vmoptions」,不是 studio.exe 那個。

Mac(Linux 亦可參考)

網上常見的做法是直接設定環境變數:

$ export REQUIRED_JVM_ARGS="-Didea.updates.url=https://dl.google.com/android/studio/patches/updates.xml -Didea.patches.url=https://dl.google.com/android/studio/patches/"
$ bin/studio

這個方法我試了多次都失敗,最後換了另一條路才成功:

在「/Applications/Android Studio.app」上按右鍵選擇「顯示套件內容」,開啟「/bin/idea.vmoptions」,把上面 Windows 那三行加進去:

-Djava.net.preferIPv4Stack=true
-Didea.updates.url=https://dl.google.com/android/studio/patches/updates.xml
-Didea.patches.url=https://dl.google.com/android/studio/patches/

存檔退出,重新開啟 Android Studio 執行 Check for Updates…,更新提示就會出現。

註:此法為自行摸索、僅確認在本機可行,並非官方建議做法。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved