I have been writing Android automated testing frameworks. Gradually, I began to be interested in the underlying architecture of Android. I was eager to study the underlying architecture of Android, so I tried to download the android source code.
I didn't know much about Linux before, But I know little about it. This article was written at in the project where you downloaded the source code. Many articles have been referenced. In this article, we will list the sources for your consideration and research. In Windows 7, I installed ubuntu10.10 with Vmware for download.
I. Preparations
1. Download VMware and ubuntu10.10
There are a lot of VMware, so I will not give the address here when I search a lot on the Internet. The following is a Ubuntu 10.
Http://www.cnbeta.com/articles/124063.htm
After downloading the image file, you can create a virtual machine in VMware. Here we have created a Ubuntu virtual machine, which is still a problem. We will discuss the specific problem later. Enter the password you used to create Ubuntu and enter ubuntu.
2. Install JDK
There are two ways to install JDK: one is to directly use the command
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"$ sudo apt-get update$ sudo apt-get install sun-java6-jdk
Do not copy this symbol to the terminal together.
However, this method is not suitable for beginners. if you add the following configuration environment variables or something, it will be dizzy. Therefore, we recommend that you install the SDK manually and configure the environment variables. Next, we recommend an article for beginners to manually install and set environment variables.
Http://weixiaolu.iteye.com/blog/1401786
The only drawback of this article is that JDK is not provided, and you may find it on the Internet. In fact, most of the searches on the Internet are in the tar.gz format, and most of them are in different installation aspects. These differences are fatal for beginners.
After my search, I found a JDK official
Http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html
Note that the file names are different, so you must change the name When configuring environment variables. Otherwise, the installation fails.
Ii. initialize the download Environment
1. The remaining capacity of the disk where Ubuntu is located should be as large as possible, with a minimum capacity of 6-10 Gb. This is just a download. If it is compiled, it will be around 20 GB.
2. Install git
Press the shortcut key Alt + Ctrl + T on the desktop to enter the terminal, and enter the following command
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \ libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \ libxml2-utils xsltproc
It is best to execute this command before executing this command.
$sudo apt-get update
To update the available source. If the Error 404 still persists after execution, it indicates your/etc/APT/sources. the source in the list file is incorrect, and most of the ubuntu10.10 files will have this problem. You can replace the source in/etc/APT/sources. list with the source below to solve this problem.
deb http://ubuntu.srt.cn/ubuntu/ natty main universe restricted multiverse deb-src http://ubuntu.srt.cn/ubuntu/ natty main universe restricted multiverse deb http://ubuntu.srt.cn/ubuntu/ natty-security universe main multiverse restricted deb-src http://ubuntu.srt.cn/ubuntu/ natty-security universe main multiverse restricted deb http://ubuntu.srt.cn/ubuntu/ natty-updates universe main multiverse restricted deb http://ubuntu.srt.cn/ubuntu/ natty-proposed universe main multiverse restricted deb-src http://ubuntu.srt.cn/ubuntu/ natty-proposed universe main multiverse restricted deb http://ubuntu.srt.cn/ubuntu/ natty-backports universe main multiverse restricted deb-src http://ubuntu.srt.cn/ubuntu/ natty-backports universe main multiverse restricted deb-src http://ubuntu.srt.cn/ubuntu/ natty-updates universe main multiverse restricted
Enter the following command on the terminal to edit the file/etc/APT/sources. List.
$sudo gedit /etc/apt/sources.list
After you enter this command, the source file will be opened in a format similar to notepad and enter the graphical editing interface. Then, you can replace the source in it with the source given above. Before performing this replacement, remember to make an error in the sources. list file under the backup.
Run the following command to check whether the installation is successful:
$git --version
If the version number of git appears, the installation is successful.
3. Install and initialize Repo
(1) Make sure that the home interface has a bin folder. If not, enter the following command on the terminal:
$ mkdir ~/bin$ PATH=~/bin:$PATH
(2) download the repo script, make sure it can be executed, and grant it the execution permission
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repo
(3) create a path for storing the android source code and enter the path.
$mkdir Android$cd Android
(4) initialize Repo
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
3. Download the android source code
1. Execute the following command to download the source code
$repo sync
2. the download may take a long time and may be disconnected. I have already been disconnected three times. It is a tragedy. So download it slowly.
If the center is disconnected, perform the first step. Compilation will continue after the download is complete.
References:
(1) http://www.cnblogs.com/and_he/archive/2012/01/04/2312027.html
I would like to express my deep gratitude to the blogger. The method in it is very easy to use. Unlike some irresponsible authors who directly repost others' blog posts, they do not add verification so that sometimes the forwarding is wrong. Despise such a person.
(2) official documents
Http://source.android.com/source/initializing.html
(3) list of sources in sources. List
http://blog.csdn.net/fly542/article/details/6758342
(4) JDK configuration in Ubuntu
http://weixiaolu.iteye.com/blog/1401786