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 internal error as below, you just need the constancy or re do the "repo sync" command !!
=========== Get error: ========================================
[Plain]
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 returneerror: 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: ==============================
[Plain]
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 ============================
[Plain]
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/
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 later -----------------------------------------------------------
The error:
[Plain] view plaincopyprint?
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/subcmds/sync. py", line 200, in _ FetchHelper
Clone_bundle = not opt. no_clone_bundle)
File "/home/cxl/android_source/. repo/project. py", line 968, in Sync_NetworkHalf
And self. _ ApplyCloneBundle (initial = is_new, quiet = quiet ):
File "/home/cxl/android_source/. repo/project. py", line 1526, in _ ApplyCloneBundle
Exist_dst = self. _ FetchBundle (bundle_url, bundle_tmp, bundle_dst, quiet)
File "/home/cxl/android_source/. 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: '000000'
Error: Cannot fetch platform/external/qemu
============= Solution: ======================================
[Plain]
(Http://source.android.com/source/downloading.html) has paragraph description, if seriously executed can solve.
1. log on to https://android.googlesource.com/new-passwordin the browser and use the gmailaccount number to renew it;
2. Click "Allow access" on the webpage to obtain the following information:
[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. append the above information (<userName> and <password> with your own real information) ~ /. The End Of The netrc file;
4. The URI is changed to the https://android.googlesource.com/a/platform/manifest ('/A' is added in the middle ").
Then follow the normal steps described on the official website to pull down the Android source code.
The official statement is: Because access is basically anonymous, in order to prevent too many connections, the number of connections to the same IP address is limited. It seems to be using a gmail account for authentication. Www.2cto.com
In this case, you will often encounter this problem when downloading from the company network or using virtual machines.
Author: iamcxl369