Android-SDK无法更新的问题解决
2016-02-15 11:33
387 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。
最近刚换了电脑,开始搭建Android开发环境的时候,下载SDK总是会出现如下错误:
[java] view
plain copy
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml.
据说dl-ssl.google.com在大陆被强了,伟大的天朝真是不让人活了,解决方法就是修改C:\Windows\System32\drivers\etc\hosts文件。添加一行:
[java] view
plain copy
74.125.237.1 dl-ssl.google.com
这里需要注意的是hosts文件是只读的,我们没有权限修改,需要我们将hosts文件复制到桌面或者其他地方,然后修改,代码如下:
[java] view
plain copy
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
//亲,就是增加这一句哦
74.125.237.1 dl-ssl.google.com
然后保存,复制修改后的hosts文件到C:\Windows\System32\drivers\etc 目录,替换文件就好!!!我们再次下载SDK的时候就会成功啦,如下图:
嘿嘿,大功告成啦!!!
PS:补充下,在mac或Linux中,hosts文件所在位置为/etc/hosts,可以使用sudo vim /etc/hosts来编辑。
最近刚换了电脑,开始搭建Android开发环境的时候,下载SDK总是会出现如下错误:
[java] view
plain copy
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml.
据说dl-ssl.google.com在大陆被强了,伟大的天朝真是不让人活了,解决方法就是修改C:\Windows\System32\drivers\etc\hosts文件。添加一行:
[java] view
plain copy
74.125.237.1 dl-ssl.google.com
这里需要注意的是hosts文件是只读的,我们没有权限修改,需要我们将hosts文件复制到桌面或者其他地方,然后修改,代码如下:
[java] view
plain copy
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
//亲,就是增加这一句哦
74.125.237.1 dl-ssl.google.com
然后保存,复制修改后的hosts文件到C:\Windows\System32\drivers\etc 目录,替换文件就好!!!我们再次下载SDK的时候就会成功啦,如下图:
嘿嘿,大功告成啦!!!
PS:补充下,在mac或Linux中,hosts文件所在位置为/etc/hosts,可以使用sudo vim /etc/hosts来编辑。
相关文章推荐
- android中activity相关任务栈(1)
- Android远程获取图片并本地缓存
- Android仿英语流利说取词放大控件的实现方法(附demo源码下载)
- Android杂谈--Activity、Window、View的关系
- Android ListView详解
- Android中的坐标系
- 使用 Gradle 管理你的 Android Studio 工程
- 关于新手在控件中设置监听器程序停止运行的错误
- android调试bug集锦 onActivityResult立即返回,并且被CANCEL
- Android手势滑动实现ImageView缩放图片大小
- android apk 签名信息 相关
- Android AlertDialog对话框
- Android drawable文件夹下部分文件介绍
- Android开发之资源文件用法实例总结
- Android手势控制实现缩放、移动图片
- Android 解决65535的限制 使用android-support-multidex解决Dex超出方法数的限制问题,让你的应用不再爆棚
- Android 性能优化 TraceView工具的使用
- 【收集】Android开源库
- Android实现手势滑动多点触摸放大缩小图片效果
- android测试工具小总结