My environments: Ubuntu 11.04
Android source code: Android-4.1.1.1_r4
How to download the Android source code?
Referenced from:http://source.android.com/source/downloading.html
But maybe you will get many error as below, you just need the constancy or re do the "repo sync" command!!
=========Get error:===========================
fatal: Not a git repository: '/home/yourname/android_source/.repo/projects/abi/cpp.git'
fatal: Not a git repository: '/home/yourname/android_source/.repo/projects/abi/cpp.git'
error: Cannot fetch platform/abi/cpp
warn: --force-broken, continuing to sync
Fetching projects: 3% (7/228) fatal: Not a git repository: '/home/yourname/android_source/.repo/projects/cts.git'
fatal: Not a git repository: '/home/yourname/android_source/.repo/projects/cts.git'
error: Cann ot fetch platform/cts
warn: --force-broken, continuing to sync
error: The requested URL returned error: 403 while accessing https://android.googlesource.com/platform/development/info/refs
fatal: HTTP request failed
error: gnutls_handshake() failed: A TLS packet with unexpected length was received. while accessing https://android.googlesource.com/platform/ development/info/refs
fatal: HTTP request failed
error: Cannot fetch platform/development
warn: --force-broken, continuing to sync
========Sovle above problem:============================
cxl@cxl-ThinkPad-E420:~/android_source/.repo/projects/abi$ rm -f -r cpp.git
cxl@cxl-ThinkPad-E420:~/android_source/.repo/projects/rm -f -r cts.git
========Finish download the source code=================
cxl@cxl-ThinkPad-E420:~/android_source$ repo sync
......
* [new tag] android-4.1.1_r4 -> android-4.1.1_r4
remote: Counting objects: 1, done
remote: Finding sources: 100% (1/1)
remote: Total 1 (delta 0), reused 1 (delta 0)
Unpacking objects: 100% (1/1), done.
From https://android.googlesource.com/platform/packages/apps/BasicSmsReceiver
* [new tag] android-4.1.1_r4 -> android-4.1.1_r4
remote: Counting objects: 65, done
remote: Finding sources: 100% (40/40)
remote: Getting sizes: 100% (40/40)
remote: Compressing objects: 100% (15/15)
remote: Total 40 (delta 21), reused 36 (delta 21)
Unpacking objects: 100% (40/40), done.
From https://android.googlesource.com/platform/sdk
9d34dab..0920b8e master -> aosp/master
Fetching projects: 100% (294/294), done.
info: A new version of repo is available
project .repo/repo/
Updating e8f75fa..5e7127d
Fast-forward
docs/manifest-format.txt | 13 ++++-
git_command.py | 2 +-
manifest_xml.py | 19 ++++--
project.py | 148 +++++++++++++---------------------------------
subcmds/overview.py | 80 +++++++++++++++++++++++++
subcmds/sync.py | 6 +-
subcmds/upload.py | 5 +-
7 files changed, 157 insertions(+), 116 deletions(-)
create mode 100644 subcmds/overview.py
info: Restarting repo with latest version
Fetching projects: 100% (294/294), done.
Checking out files: 100% (4587/4587), done.ut files: 36% (1666/4587)
Checking out files: 100% (6222/6222), done.out files: 26% (1625/6222)
Checking out files: 100% (8843/8843), done. out files: 8% (755/8843)
Checking out files: 100% (24601/24601), done.ut files: 40% (9923/24601)
Checking out files: 100% (17893/17893), done.ut files: 8% (1465/17893)
Checking out files: 100% (624/624), done.
Checking out files: 100% (974/974), done.ng out files: 1% (12/974)
Checking out files: 100% (667/667), done.ng out files: 15% (104/667)
Checking out files: 100% (370/370), done.ng out files: 8% (30/370)
Checking out files: 100% (2407/2407), done. out files: 29% (720/2407)
Checking out files: 100% (2412/2412), done. out files: 1% (27/2412)
Checking out files: 100% (974/974), done.
Checking out files: 100% (26958/26958), done.ut files: 32% (8780/26958)
Checking out files: 100% (81/81), done.
Checking out files: 100% (441/441), done.ng out files: 46% (205/441)
Checking out files: 100% (4344/4344), done.
Syncing work tree: 100% (294/294), done.
-----------------------------------------------------Below is another solution, but it is not fix my problem,my be you can try it-----------------------------------------------------------
The error:
Exception in thread Thread-119:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/cxl/android_source/.repo/repo/subcmds/sync.py", line 200, in _FetchHelper
clone_bundle=not opt.no_clone_bundle)
File "/home/cxl/android_source/.repo/repo/project.py", line 968, in Sync_NetworkHalf
and self._ApplyCloneBundle(initial=is_new, quiet=quiet):
File "/home/cxl/android_source/.repo/repo/project.py", line 1526, in _ApplyCloneBundle
exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet)
File "/home/cxl/android_source/.repo/repo/project.py", line 1590, in _FetchBundle
raise DownloadError('%s: %s ' % (req.get_host(), str(e)))
DownloadError: android.googlesource.com: <urlopen error [Errno 8] _ssl.c:503: EOF occurred in violation of protocol>
error: RPC failed; result=56, HTTP code = 200B
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
warning: https unexpectedly said: '0000'
error: Cannot fetch platform/external/qemu
===========solution:==========================
(http://source.android.com/source/downloading.html)有段说明,如果认真执行就可解决。
1. 浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录;
2. 点击网页上的“允许访问”,得到类似:
[plain]
1. machine android.googlesource.com login git-<userName>.gmail.com password <password>
2. machine android-review.googlesource.com login git-<userName>.gmail.com password <password>
的信息。
3. 把上面那段信息(<userName>和<password>用自己得到的真实信息)追加到~/.netrc文件结尾;
4. 下载地址的URI更改为https://android.googlesource.com/a/platform/manifest(中间加上了“/a”)。
然后按照官网描述的正常步骤操作,即可拉下Android源码。
官方的说法是:因为访问基本是匿名的,为了防止连接过多,对同一IP地址的连接数做了一定的限制。看来是用gmail帐号进行认证。
这样的话,在公司网络内或者用虚拟机下载的话,会经常遇到这问题。
PS:
这一步骤必须把之前的.repo删除掉才行.
分享到:
相关推荐
下载后解压到sdk下sources文件夹中,再在eclipse中将其关联起来,就可以很方便地查看android source code了。 针对API20的。
flash 源代码-flash source code flash 源代码-flash source code flash 源代码-flash source code
《精通 Android 3》 是一本好书,这个书上的例子便是学号这本书的媒介,所有源代码都在这个附件中!
google play上android weatherWidget的源代码
NULL 博文链接:https://flower-is.iteye.com/blog/952013
vnc viewer source code for android
这是Android Framework Source Code,下载并解压后,将解压出的整个文件夹复制或者移动到 your sdk 路径/sources文件夹下,然后重启Eclipse(或Android Studio),这样当你在Eclipse里面按住 Ctrl键点击某个系统类时就...
Android-SourceCode_Analysis:Android源代码分析
android mdict词典的源代码,好东西
Android-App:Android App源代码
pro android 4 pdf and source code ,英文版PDF和配套源代码。
androidsourcecodes 回声“#androidsourcecodes” >> README.md git init ...#windows控制台cmd乱码的解决方法 我本机的系统环境: 操作系统名称:Microsoft Windows 10企业版 操作系统版本:10.0.
AndroidGame:源代码
Android Hacks源代码
我们可以通过该项目读取和修改android native C / C ++代码。 我们可以编译自己的Android C / C ++代码以在Android设备上运行。 当然,感谢CLion团队,所有这些都是基于CLion的。 自动找到模块的路径。 自动解析...
安卓 Android App源代码和构建文件(需要Android Studio)
android_calculator:Android源代码
android2.2源代码下载,将下载的文件sources.rar解压后放置在android.jar所在目录中。如\android-sdk-windows\platforms\android-8\sources\...包...。 源码包含了android.jar中android包以及apache包的所有源文件。
android2.1源代码下载,将下载的文件sources.rar解压后放置在android.jar所在目录中。如\android-sdk-windows\platforms\android-7\sources\...包...。
原始下载地址:http://code.google.com/p/nfcard/source/checkout 这是一个开源的读各地NFC公交卡的程序。