最近刚换了电脑,开始搭建Android开发环境的时候,下载SDK总是会出现如下错误:

[java] view plain copy
  1. FailedtofetchURLhttp://dl-ssl.google.com/android/repository/addons_list-1.xml.

据说dl-ssl.google.com在大陆被强了,伟大的天朝真是不让人活了,解决方法就是修改C:\Windows\System32\drivers\etc\hosts文件。添加一行:

[java] view plain copy
  1. 74.125.237.1dl-ssl.google.com

这里需要注意的是hosts文件是只读的,我们没有权限修改,需要我们将hosts文件复制到桌面或者其他地方,然后修改,代码如下:

[java] view plain copy
  1. #Copyright(c)1993-2009MicrosoftCorp.
  2. #
  3. #ThisisasampleHOSTSfileusedbyMicrosoftTCP/IPforWindows.
  4. #
  5. #ThisfilecontainsthemappingsofIPaddressestohostnames.Each
  6. #entryshouldbekeptonanindividualline.TheIPaddressshould
  7. #beplacedinthefirstcolumnfollowedbythecorrespondinghostname.
  8. #TheIPaddressandthehostnameshouldbeseparatedbyatleastone
  9. #space.
  10. #
  11. #Additionally,comments(suchasthese)maybeinsertedonindividual
  12. #linesorfollowingthemachinenamedenotedbya'#'symbol.
  13. #
  14. #Forexample:
  15. #
  16. #102.54.94.97rhino.acme.com#sourceserver
  17. #38.25.63.10x.acme.com#xclienthost
  18. #localhostnameresolutionishandledwithinDNSitself.
  19. #127.0.0.1localhost
  20. #::1localhost
  21. //亲,就是增加这一句哦
  22. 74.125.237.1dl-ssl.google.com
然后保存,复制修改后的hosts文件到 C:\Windows\System32\drivers\etc 目录,替换文件就好!!!我们再次下载SDK的时候就会成功啦,如下图:

嘿嘿,大功告成啦!!!

PS:补充下,在mac或Linux中,hosts文件所在位置为/etc/hosts,可以使用sudovim/etc/hosts来编辑。

更多相关文章

  1. How to use HTC on Ubuntu 12.04 to test Android(安卓)Apps?
  2. (血的经验!!)Android(安卓)Studio 如何导入别人的项目?
  3. 修改apk调用蓝牙无明确提示
  4. ButterKnife 8.8.1版本在AndroidStudio中的配置(附Android(安卓)s
  5. Android(安卓)OpenCV 安装与配置+JNI开发
  6. Android5.1.1-APK签名校验分析和修改源码绕过签名校验
  7. Android点划线自定义View
  8. android 添加自定义theme和style
  9. android:Adapter中无法设置textview字体颜色(解决)

随机推荐

  1. Android第十九期 - Sqlite离线存储教你写
  2. 【设计模式与Android】原型模式——复制
  3. 基于jquery的小记事本,及$.get/$.post/$.a
  4. 第三篇 android 应用开发模式之MVC模式及
  5. Android"挂逼"修炼之行---微信摇骰子和猜
  6. Android短信Receiver优先级
  7. 五月小结
  8. 融云 Android(安卓)sdk 2.1+ 稳定版 UI
  9. 一步步客制化Android桌面(Launcher3)图标
  10. Android多分辨率适配经验总结