I'm very glad that today we have a link with the android development website and the source code website. Although it is a bit difficult, it is still worth it !!
Summary download source code method, from http://source.android.com/source/downloading.html
Before installation, ensure that git and curl are installed. If not, run the following command:
Sudo apt-Get install Git-core curl
Installing Repo
Install the repo script file.
Note: Create the bin directory under your/home/username directory. If you want to use it conveniently, add the directory to the path.
I didn't add it to the path in this way, and directly create the/bin directory under/home/myname.
cd /home/markmkdir bin
Download the repo script and ensure it is executable:
Download the repo script file to the/home/mark/bin directory.
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Note: If the subsequent operation fails, download the repo file again.
Modify file permissions:
chmod a+x ~/bin/repo
Create a directory named android_src:
cd /home/markmkdir android_src
Go to the android_src directory:
cd android_src
Initialization
~/bin/repo init -u https://android.googlesource.com/platform/manifest
If you want to download the specified source code, you can add a parameter-B:
~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
Finally, run the following command to download the android source code:
~/bin/repo sync
Wait for the download. If the download fails,Re-Execute ~ /Bin/repo sync
Note: The steps for downloading the android source code are mainly on the official website. The official website provides detailed methods and steps.
In particular, when downloading and installing the repo file, compare the download methods on the official website, download the repo again, and delete the original repo file. Otherwise, you will encounter the following error message:
fatal: unable to connect a socket (Connection refused)
This is because you have not updated (re-downloaded the repo file) or used the original script file!