Download Ubuntu Android source code

Source: Internet
Author: User
Tags gnupg valgrind

For a layman like me who doesn't know much about Unix systems, the source code of Android must be suffering. After a whole day of failure, I finally successfully downloaded it after finding someone else's most recent tutorial. First, provide the original text:

 

In the past two days, we have started to prepare the source code compilation. In this case, we will record the process so that we can easily back up the source code and hope it will be helpful to the later users.

Attention: the environment in this article is to obtain and compile the source code of Android 2.3.3 under Ubuntu 11.04,

 

The process reference easwy's blog: http://www.2cto.com/kf/201111/110741.html

And Google official website http://source.android.com/source/downloading.html.

 

The requirements on the official website are:

In general you will need:

• Python 2.4 -- 2.7, which you can download from python.org.

• JDK 6 if you wish to build gingerbread or newer; JDK 5 for froyo or older. You can download both from java.sun.com.

• Git 1.5.4 or newer. You can find it at git-scm.com.

• (Optional) valgrind, a tool that will help you find memory leaks, stack rollback uption, Array Bounds overflows, etc. Download from valgrind.org.

In addition: 6 GB or more disk space, dependent Deb package: Flex, Bison, gperf, libsdl-Dev, libesd0-dev, libwxgtk2.6-Dev, Build-essential, zip, curl

I. Preparations before downloading

First, after preparing the required disk space, install the required development kits and execute the following commands on the terminal:

$ Sudo apt-Get install Git-core GnuPG flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

Here, you need to pay attention to two points: 1. libsdl version 1.2; 2. zlib1g-dev do not see the error is 1 rather than l, of course, not the hands of the Tx there is no such problem.

Then you need to install the Java environment and view the version directly on the terminal:

Wayne @ Ubuntu :~ $ Java-version

Program"Java" is included in the following software packages:

* Gcj-4.4-jre-headless

* Gcj-4.5-jre-headless

* Openjdk-6-jre-headless

Please try: sudo apt-Get install <selected software package>

Input: sudo apt-Get install openjdk-6-jre-headless, installation is OK, and then view the version:

Wayne @ Ubuntu :~ $ Java-version

Java version "1.6.0 _ 22"

Openjdk Runtime Environment (icedtea6 1.10.2) (6b22-1.10.2-0ubuntu1 ~ 11.04.1)

Openjdk server VM (build 0-b11, mixed mode)

JDK is installed.

Ii. Download source code

Now we have prepared the environment required for Android source code development (no error). The process of downloading the source code is very huge because the android source code needs to be obtained in two parts: Android source code and kernel. I don't need the source code of the kernel for the time being, so here I only download the source code.

1. Create a new folder to store the android directory and initialize the repo:

Wayne @ Ubuntu :~ $ Mkdir android

Wayne @ Ubuntu :~ $ CD android

Wayne @ Ubuntu :~ /Android $ mkdir Bin

Wayne @ Ubuntu :~ /Android $ CD Bin

Wayne @ Ubuntu :~ /Android/bin $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> Repo

% Total % received % xferd average speed time Time Current

Dload upload total spent left speed

100 19731 100 19731 0 0 14034 0 0:00:01 --: -- 17157

 

Here, a few months ago:

Wayne @ Ubuntu :~ /Android/bin $ curl http://android.git.kernel.org/repo> Repo

% Total % received % xferd average speed time Time Current

Dload upload total spent left speed

100 244 100 244 0 0 75 0 0:00:03 --: -- 976

ThenCodeThe following error occurs during initialization:

./Bin/repo: Row 1: Unexpected syntax error near the symbol 'newline'

./Bin/repo: Row 1: '<! Doctype HTML public "-// IETF // dtd html 2.0 // en">'

2. continue now. Create and store the source code directory and initialize the required Android source code version. Run the following command on the terminal:

Wayne @ Ubuntu :~ /Android/bin $ sudo chmod A + x Repo

Wayne @ Ubuntu :~ /Android/bin $ cd

Wayne @ Ubuntu :~ $ CD Android/source/

Wayne @ Ubuntu :~ /Android/source $ ../bin/repo init-u https://android.googlesource.com/platform/manifest-B android-2.3.3_r1

GPG: the key ring '/home/Wayne/. repoconfig/GnuPG/secring. gpg' has been created.

GPG: the key ring '/home/Wayne/. repoconfig/GnuPG/pubring. gpg' has been created.

GPG:/home/Wayne/. repoconfig/GnuPG/trustdb. GPG: Build a trust Database

GPG: Key 920f5c65: Public Key "Repo maintainer <repo@android.kernel.org>" imported

GPG: Total number of processed items: 1

GPG: imported: 1

 

Get https://android.googlesource.com/tools/repo

Remote: counting objects: 1414, done

Remote: Finding sources: 100% (78/78)

Remote: Total 1414 (delta 917), reused 1414 (delta 917)

Grouping objects: 100% (1414/1414), 429.88 kib | 169 kib/s, done.

Resolving deltas: 100% (917/917), done.

From https://android.googlesource.com/tools/repo

* [New branch] Maint-> origin/Maint

* [New branch] Master-> origin/Master

* [New branch] stable-> origin/stable

...Www.2cto.com

In this case, you are required to enter the user name and email address.

After initialization, the following error occurs:

Repo initialized in/home/Wayne/Android/source

Now you can download the SDK after initialization. Run the following command on the terminal to download the SDK:

Wayne @ Ubuntu :~ /Android/source $ ../bin/repo sync

It takes a long time to download all the source code, and now it is going through a long wait ......

During the process, you may encounter errors and interruptions:

Error: Exited sync due to fetch errors

If you encounter these problems, re-execute ../bin/repo sync and then OK.

 

Iii. Compile source code

The Compilation part should be recorded after the download is completed. It will be provided later.

Extracted from migrant workers with poor spirits

 

From the CTO forum.

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.