Obtain and compile the Android source code in Ubuntu

Source: Internet
Author: User
1. Configure the environment 1. the disk requires more than 6 GB space. 2. linux Ubuntu6.06 or later, I use the Ubuntu9.103.Git tool (Git1.5.4 or later). It is a version management tool similar to CVS. If your code does not need to be downloaded from the Internet, instead of the tool $ sudoapt-getinstallgit-coregnupg4. & nbs

I. Configure the environment

1. Disk
6 GB or more space is required

2. Linux

I use Ubuntu 6.06 or later.

3. Git tool (Git 1.5.4 or later)
It is a version management tool similar to CVS. If your code does not need to be downloaded from the Internet, but copied from someone else, this tool is not required.
$ Sudo apt-get install git-core gnupg

4. Java environment (JDK 5.0 update12 or later)
$ Sudo apt-get install sun-java6-jdk
For more information, see here.

5. Python (Python 2.4 or later)
Download version 2.4from http://www.python.org/download/
$ Tar xvzf python-2.4.5.tgz
$ Cd python-2.4.5/
$./Configure
$ Make; make install

6. Dependent deb package
$ Sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl
The flex bison build-essential zip curl can be installed from the CD
Other gperf libsdl-dev libesd0-dev libwxgtk2.6-dev needs to be installed from the Internet, they also rely on some installation packages, so use apt-get to download, do not directly under deb package installation

7. debugging tools
$ Sudo apt-get install valgrind

Ii. Download and compile and run the Android source code

1. Download the installation script
$ Wget http://android.git.kernel.org/repo
$ Chmod 777 repo
$ Cp repo/bin/

2. Use the installation script to download the source code.
$ Mkdir android_code
$ Cd android_code
$ Repo init-u git: // android.git.kernel.org/platform/manifest.git
$ Repo sync
The above command is to download the latest version, you can also download other versions
For example, if the mobile phone I bought is set to 1.5 in Settings> about mobile phone> firmware version, download version 1.5 as follows:
$ Repo init-u git: // android.git.kernel.org/platform/manifest.git-B android-1.5r3
$ Repo sync // download later

3. Compile

1) normal Compilation
$ Cd android_code
$ Make
After the image is compiled, some image files will be generated in the directory android_code/src/out/target/product/generic: ramdisk. img system. img userdata. img

2) Possible Problems and Solutions

1. make: if the message "-lncurses" is not found, you need to make the following link:
Ln-s/lib/libncurses. so.5/lib/libncurses. so

2. If the prompt "run-java-tool" cannot be found for "make" is displayed, you must set the java installation path.
$ Export ANDROID_JAVA_HOME = $ JAVA_HOME

3. If you cannot find zlib. h, run the following command to install zlib.
$ Sudo apt-get install zlib1g-dev

4. After the latest version is released, it is shown that only java-1.5 can be used, and www.linuxidc.com is reduced from 1.6 to 1.5.
$ Sudo apt-get install sun-java5-jdk flex
$ Sudo update-java-alternatives-s java-1.5.0-sun

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.