http://blog.csdn.net/gyming/article/details/8168166/
最近接受的這個專案需要Android SDK Tools revision 22.6.2 or above.,所以必須得更新SDK,
然而在SDKmanager中更新android SDK 總是提示:
Fetching http://dl-ssl.google.com/android/repository/addons_list-2.xml
Fetched Add-ons List successfully
Fetching URL: http://dl-ssl.google.com/android/repository/repository-8.xml
Done loading packages.
Fetching http://dl-ssl.google.com/android/repository/addons_list-2.xml
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Unknown Host http://proxy.global.sonyericsson.net
Fetched Add-ons List successfully
Fetching URL: http://dl-ssl.google.com/android/repository/repository-8.xml
Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-8.xml, reason: IO Unknown Host http://proxy.global.sonyericsson.net
Done loading packages.
在網上查了很多方法想 修改hosts檔案、設定代理等不可行,最後只能通過有點麻煩的方法解決了
1.下載3個xml檔案:
http://dl-ssl.google.com/Android/repository/addon.xml
http://dl-ssl.google.com/Android/repository/repository.xml
http://dl-ssl.google.com/Android/repository/repository-5.xml
2.根據xml檔案中的內容獲取下載zip包的連線如下:
==========================================================================
<!-- http://dl-ssl.google.com/Android/repository/addon.xml begin-->
<!-- ADD-ONS ....................... -->
http://dl-ssl.google.com/Android/repository/google_apis-3-r03.zip
http://dl-ssl.google.com/Android/repository/google_apis-4_r02.zip
http://dl-ssl.google.com/Android/repository/google_apis-5_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-6_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-7_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-8_r02.zip
http://dl-ssl.google.com/Android/repository/google_apis-9_r02.zip
http://dl-ssl.google.com/Android/repository/google_apis-10_r02.zip
http://dl-ssl.google.com/Android/repository/google_apis-11_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-12_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-13_r01.zip
http://dl-ssl.google.com/Android/repository/google_apis-14_r01.zip
<!-- GOOGLE TV ADDONS ............. -->
http://dl-ssl.google.com/Android/repository/google_tv-12_r02.zip
<!-- EXTRAS ....................... -->
http://dl-ssl.google.com/Android/repository/market_licensing-r01.zip
http://dl-ssl.google.com/Android/repository/usb_driver_r04-windows.zip
http://dl-ssl.google.com/Android/repository/market_billing_r01.zip
http://dl-ssl.google.com/Android/repository/webdriver_r01.zip
<!-- http://dl-ssl.google.com/Android/repository/addon.xml end-->
==========================================================================
==========================================================================
<!-- http://dl-ssl.google.com/Android/repository/repository.xml begin-->
<!-- PLATFORM-TOOL ........................ -->
https://dl-ssl.google.com/Android/repository/platform-tools_r09-windows.zip
<!-- TOOLS ........................ -->
https://dl-ssl.google.com/Android/repository/tools_r15-windows.zip
<!-- http://dl-ssl.google.com/Android/repository/repository.xml end-->
==========================================================================
==========================================================================
<!-- http://dl-ssl.google.com/Android/repository/repository-5.xml begin-->
<!-- PLATFORMS ........................ -->
https://dl-ssl.google.com/Android/repository/android-1.1_r1-windows.zip
https://dl-ssl.google.com/Android/repository/android-1.5_r04-windows.zip
https://dl-ssl.google.com/Android/repository/android-1.6_r03-windows.zip
https://dl-ssl.google.com/Android/repository/android-2.0_r01-windows.zip
https://dl-ssl.google.com/Android/repository/android-2.0.1_r01-windows.zip
https://dl-ssl.google.com/Android/repository/android-2.1_r03-linux.zip
https://dl-ssl.google.com/Android/repository/android-2.2_r03-linux.zip
https://dl-ssl.google.com/Android/repository/android-2.3.1_r02-linux.zip
https://dl-ssl.google.com/Android/repository/android-2.3.3_r02-linux.zip
https://dl-ssl.google.com/Android/repository/android-3.0_r02-linux.zip
https://dl-ssl.google.com/Android/repository/android-3.1_r03-linux.zip
https://dl-ssl.google.com/Android/repository/android-3.2_r01-linux.zip
https://dl-ssl.google.com/Android/repository/android-14_r01.zip
https://dl-ssl.google.com/Android/repository/android-18_r01.zip
https://dl-ssl.google.com/Android/repository/android-18_r01.zip
<!-- SYSTEM IMAGES ........................ -->
https://dl-ssl.google.com/Android/repository/sysimg_armv7a-14_r01.zip
<!-- SAMPLES ........................ -->
https://dl-ssl.google.com/Android/repository/samples-2.1_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-2.2_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-2.3_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-2.3.3_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-3.0_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-3.1_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-3.2_r01-linux.zip
https://dl-ssl.google.com/Android/repository/samples-14_r01.zip
<!-- PLATFORM-TOOLS ........................ -->
https://dl-ssl.google.com/Android/repository/platform-tools_r08-windows.zip
<!-- TOOLS ........................ -->
https://dl-ssl.google.com/Android/repository/tools_r14-windows.zip
<!-- DOCS ........................ -->
https://dl-ssl.google.com/Android/repository/docs-14_r01.zip
https://dl-ssl.google.com/Android/repository/docs-15_r01.zip
https://dl-ssl.google.com/Android/repository/docs-16_r01.zip
https://dl-ssl.google.com/Android/repository/docs-17_r01.zip
https://dl-ssl.google.com/Android/repository/docs-18_r01.zip
https://dl-ssl.google.com/Android/repository/docs-19_r01.zip
<!-- EXTRAS ........................ -->
https://dl-ssl.google.com/Android/repository/support_r10.zip
https://dl-ssl.google.com/Android/repository/support_r11.zip
https://dl-ssl.google.com/Android/repository/support_r12.zip
https://dl-ssl.google.com/Android/repository/support_r13.zip
<!-- http://dl-ssl.google.com/Android/repository/repository-5.xml end-->
3.下載完後,在<sdk>/temp/資料夾中放入需要安裝版本的zip包
4.執行sdk manager.exe開始安裝,這是安裝將跳過下載部分直接安裝
5.安裝完成
使用該方法,記得一定設定android-sdk的環境變數 哦。。
參考設定android的環境變數 http://www.cnblogs.com/yuan1225/archive/2013/05/15/3079626.html
記得之前修改hosts檔案可以的,但是這次卻不行了
修改hosts檔案。
(1)windows下開啟C:\Windows\System32\drivers\etc,以管理員身份編輯hosts檔案,在最後新增:
74.125.237.1 dl-ssl.google.com
(2)linux下使用命令sudo vim /etc/hosts編輯hosts檔案,同樣在檔案最後新增
74.125.237.1 dl-ssl.google.com
然後重新執行sdk manager,就可以下載了。
設定代理:
參考文件
http://www.oschina.net/question/163910_30669
如果喜歡作者的文章,請關注"寫程式碼的猿"訂閱號以便第一時間獲得最新內容。本文版權歸作者所有,歡迎轉載.