Use git and repo to obtain the android source code

Source: Internet
Author: User

In some cases, we need to check the android source code or recompile it. Currently, only Android source code can be compiled on Linux or Mac OS, But windows is not supported. so this article introduces how to obtain the android source code on Ubuntu.

 

The android source code is about 2.1 GB. here we can see its structure and update records.

 

Git and repo are required to download the android source code. Git is an open-source distributed version control software that is ideal for managing large projects. project files can be stored in multiple git repositories (repositories ), in this way, you can easily create branches and compare versions. Therefore, Android also uses them for source code management. Repo is a git-based tool that allows us to manage git repositories more conveniently.

 

Next, we need to install these two tools on Ubuntu. Before installation, We need to install some necessary Linux packages: JDK 5.0 (Java 6 does not support @ override incompatibility), Lex, bison, gperf, libsdl-Dev, libesd0-dev, libwxgtk2.6-Dev (optional), build-essential, zip, curl.

 

Run the following command on Terminal in Ubuntu: $ sudo apt-Get install Git-core GnuPG flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

 

Here you need to pay attention to the sun-java5-jdk source in ubuntu9.10 after there is no, so the installation of sun-java5-jdk to switch sources. List to install, specific can refer to this blog.

 

After git (GIT-core above) is installed, install Repo, create the bin directory in the home directory, obtain the repo, and grant it the execution permission:

$ Cd ~
$ Mkdir Bin
$ Curl http://android.git.kernel.org/repo> ~ /Bin/Repo
$ Chmod A + x ~ /Bin/Repo

Add the bin directory to $ path:

$ Export Path = $ home/bin: $ path

 

Then create the mydroid directory in the home directory to store the android source code.

$ Mkdir mydroid
$ CD mydroid

Finally, download the android source code:

$ Repo init-u git: // android.git.kernel.org/platform/manifest.git
$ Repo sync

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.