ArticleDirectory
- Installing some soft
- Installing Repo
- Initializing a repo Client
- Getting the files
- Problem
[Android] Android 4.2 source code download (Ubuntu 12.10) cutting-edge
Recently, I have been studying NFC. Different APIs in different versions are used differently. If you want to see the source code implementation, You have to download the android source code again ~~~
Complete steps: installing some soft
1 install curl: sudo apt-Get install curl
2 install Git-core: sudo apt-Get install Git-core
Installing Repo
1Create a ~ in the user directory ~ /Bin directory, and add it to the environment variable (to download and install the GIT software in this directory, the software may not be found in other directories, so add it to the environment variable)
$ Mkdir ~ /Bin
$ Path = ~ /Bin: $ path
2Download the repo script and change the permission to Executable
$ Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/Repo
$ Chmod A + x ~ /Bin/Repo
Initializing a repo Client
1Create a directory to save the android source code, change it to the maximum permission, and enter the Directory
$ Mkdir/opt/android4.2
$ Sudo chmod-r 777/opt/android4.2
$ CD/opt/android4.2
2Initialize the repo and select the branch (version) to be downloaded)
$ Repo init-u https://android.googlesource.com/platform/manifest
$ Repo init-u https://android.googlesource.com/platform/manifest-B android-4.2_r1
Note 1: In this process, enter your name, email address, and other information.
Note 2: Query Android version information, refer to the https://android.googlesource.com/platform/manifest/+refs
Getting the files
$ Repo sync
Problem
CodeThe following errors are frequently prompted during the download process:
Error: Failed connect to android.googlesource.com: 443; connection refused while accessinghttps: // android.googlesource.com/a/platform/frameworks/base/info/refs
Fatal: http request failed
Error: cannot fetch platform/tools/motodev
Error: cannot fetch platform/frameworks/base
Error: cannot fetch platform/prebuilts/SDK
Error: Exited sync due to fetch errors
Solution:Edit the/etc/hosts file
$ Vim/etc/hosts
Add and save the following content (save in advance ):
74.125.31.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173cache.pack.google.com
Then enter again
$ Repo sync
Android4.2 is relatively large, about GB After packaging, not about 14 GB After packaging
Ref:
1 downloading the source tree: http://source.android.com/source/downloading.html
2 android4.2 source code download process: http://blog.csdn.net/lengxibo/article/details/8299888#reply
3 http://zhu.im/Android/ is a very good link, which 1.6 to 4.2 Each version has, if you are too lazy to download it directly here to download