Ubuntu 11.04 + obtain the android source code (Supplement)

Source: Internet
Author: User
Tags gnupg gpg

Previously, I wrote the android source code for Ubuntu 11.04 to obtain the token.

After the download, the source code is compiled in Ubuntu 11.10. After the source code is compiled, Wayne will write it out and share it with you. This article is to record the problems and solutions in the process of compiling the source code, and then give reminders and suggestions on the analysis of the android source code.

Based on my previous source code retrieval, I have the following suggestions:

1. Avoid selecting wubi to install ubuntu (unstable, may cause compilation failure ).

2. When installing some Development kits, we recommend that you install the following packages to avoid some inexplicable problems during compilation:

$ Sudo apt-Get install lib64z1-dev libc6-dev-amd64 g ++-multilib lib64stdc ++ 6

3. When installing the Java environment, it is more convenient to select the online installation method. Because it will install the sun-java6-bin and sun-java6-jre and automatically configure the compilation environment.

 

The following is a summary of the modified process:

Attention: the environment in this article is to obtain and compile the source code of Android 2.3.3 _ R1 under Ubuntu 11.04 +, record the process, so that you can back up your own files and hope to help later users.

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.7 or newer. You can find it at git-scm.com.

I. Preparations before downloading

Note: The source download is approximately 6 GB in size. You will need 25 GB free to complete a single build, and up to 80 GB (or more) for a full set of builds.

1. After preparing the required disk space, install the required development kits and run the following commands on the terminal:

$ 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 lib64z1-dev libc6-dev-amd64 g++-multilib lib64stdc++6

2. Install the Java environment

Install Java 6. Because JDK is no longer included in the current Ubuntu system package library, we need to manually add the library and execute the following command:

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

When JDK was installed earlier, the official website provided two statements for adding a database and the second statement.

$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"

Yes, an error is prompted.

Error: 'deb-src http://archive.canonical.com/ lucid partner' invalid

I saw the update on the official website yesterday and removed it. It's awesome ~

 

Ii. Start to download the source code (this part is the same as Ubuntu 11.04 Android source code to get the http://www.cnblogs.com/dwayne/archive/2011/11/11/2245383.html)

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 Time Current
Dload Upload Total Spent Left Speed
100 19731 100 19731 0 0 14034 0 0:00:01 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 Time Current
Dload Upload Total Spent Left Speed
100 244 100 244 0 0 75 0 0:00:03 0:00:03 --:--:-- 976

Then, the following error occurs during subsequent code 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
...

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.

Fetching projects: 100% (165/165), done.
Checking out files: 100% (3573/3573), done.ut files: 30% (1078/3573)
Checking out files: 100% (4679/4679), done.out files: 33% (1580/4679)
Checking out files: 100% (10008/10008), done.t files: 23% (2370/10008)
Checking out files: 100% (11980/11980), done.t files: 0% (64/11980)
Checking out files: 100% (9601/9601), done. out files: 0% (67/9601)
Syncing work tree: 100% (165/165), done.

Download complete. The next step is to compile the source code, so stay tuned.

Still the same. Please contact me!

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.