127.0.1.1 sno
203.208.46.146 www.google.com
203.208.46.146 dl.google.com
203.208.46.146 dl-ssl.google.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
~
~
- 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文件。添加一行:
- 74.125.237.1 dl-ssl.google.com
这里需要注意的是hosts文件是只读的,我们没有权限修改,需要我们将hosts文件复制到桌面或者其他地方,然后修改,代码如下:
- # 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
嘿嘿,大功告成啦!!!
PS:补充下,在mac或Linux中,hosts文件所在位置为/etc/hosts,可以使用sudo vim /etc/hosts来编辑。
=====================下载源代码=========================================
严格按照:http://source.android.com/source/downloading.html来做。如果在下载repo遇到问题,看上面的配置。
如果要下载不同的android版本。用repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.3.3_r1
显示这样说明已经在下载:
cts: 100% (134/134), 77.64 KiB, done.
Resolving deltas: 100% (82/82), completed with 50 local objects.
22 145M 22 33.0M 0 0 248k 0 0:10:02 0:02:16 0:07:46 266kFrom https://android.googlesource.com/platform/dalvik
15e631e..288f228 jb-dev -> aosp/jb-dev
d454d96..b6f4e03 jb-mr1-dev -> aosp/jb-mr1-dev
c087108..583e1f6 jb-mr1-release -> aosp/jb-mr1-release
78a9a37..eeae8a8 master -> aosp/master
* [new tag] android-4.2.1_r1 -> android-4.2.1_r1
=====注,以下是转别人的,因为总是这里摘一点,哪里去一点的,不加出处了。往谅解!
遇到的问题1:
Ubuntu10.x用户可尝试如下操作:
1 修改/etc/apt/sources.list文件
把下面内容加到最后面
deb http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted
2 执行下面两个命令
sudo apt-get update
sudo apt-get install git
问题2
如果在repo sync的时候总是提示失败,可使用这个脚本:
#!/bin/bash
echo "======start repo sync======"
repo sync
while [ $? == 1 ]; do
echo "======sync failed, re-sync again======"
sleep 3
repo sync
done
问题3 :fatal: Unable to find remote helper for 'https'
安装git.1.8.2.tar.gz 在:https://code.google.com/p/git-core/downloads/detail?name=git-1.8.2.tar.gz&can=2&q=中
然后 /usr/lib/git-core$ sudo cp git-remote-https /bin
如果完成了,则显示如下:
下载源代码树:
首先,安装Repo
按照如下步骤安装,初始化,配置Repo
- 新建立一个bin目录,并加到环境变量:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
- 下载Repo脚本和修改权限为可执行:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
- Repo的校验和(这里不懂什么意思,有知道的不?)
- 新建一个空文件夹,这个文件夹名字任意取
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
- 运行repo init 更新manifest到你的工作目录,也就是上面建立的目录?
$ repo init -u https://android.googlesource.com/platform/manifest
检出一个分支而不是主干,指定 -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
- 到这里有个提示,需要输入真实姓名和email,如果想要用Gerrit code-review tool,就需要一个google账号,并确保这个账号能正常收发信息。同时你提供的名字将会显示在代码提交原因里。
$ repo sync
这里就漫长的等待。。。直到同步完毕。
Fetching projects: 100% (221/221), done.
Checking out files: 100% (13480/13480), done. files: 10% (1368/13480)
Checking out files: 100% (4556/4556), done.ut files: 11% (539/4556)
Checking out files: 100% (9385/9385), done.out files: 32% (3013/9385)
Checking out files: 100% (4582/4582), done.out files: 9% (456/4582)
Checking out files: 100% (4876/4876), done.out files: 11% (577/4876)
Checking out files: 100% (8657/8657), done.out files: 4% (367/8657)
Checking out files: 100% (644/644), done.ng out files: 22% (147/644)
Checking out files: 100% (1421/1421), done. out files: 34% (487/1421)
Checking out files: 100% (3156/3156), done.
Checking out files: 100% (24598/24598), done.ut files: 40% (9873/24598)
Checking out files: 100% (18692/18692), done.ut files: 0% (10/18692)
Checking out files: 100% (23382/23382), done.ut files: 0% (18/23382)
Checking out files: 100% (2868/2868), done. out files: 49% (1417/2868)
Syncing work tree: 100% (221/221), done.