Rookie takeoff: The first time to compile Android source on Ubuntu

Source: Internet
Author: User
Tags gz file

Calculate a calculate oneself to do Android development, still poor so few months will be full two years, but oneself even the Android source code has not compiled once, think really is justified, think of compile once, in the middle also really met a lot of problems, here write a blog for everyone reference.

Remember: Everyone's environment is not the same, maybe my compilation process can be successful, but for you are not successful, in the face of problems to be specific treatment, the specific solution, the key lies in perseverance and perseverance.

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------

Let's summarize the process first:

1. Install Ubuntu system

2. Installing the JDK Environment

3. Configuring the compilation Environment

4. Troubleshoot problems during compilation

5. Successful compilation

Problem Solving Summary:

1. Resource version is important

Environmental conditions:

ubuntu12.04, jdk1.6.45, source 2.3.7

--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------

Install Ubuntu system:

Requirements:

1. Preferably a 64-bit operating system.

2. It is best to install the simulator without using an emulator.

3. The best version is 12.04 or 10.04, I just started using 14.04 (currently the latest), but found that there is a problem always can not solve, so there is no way, just reinstall the 12.04 Ubuntu system, specific what problem, will be explained later.

--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------

Make USB drive Boot:

1. Download Ubuntu iOS image, this can be downloaded on the official website, here also provides a network address: Ubuntu64 bit 12.04

2. Prepare a well-formatted U-disk.

3. Use the U disk to start the production tools to make, the people are more familiar with the Chinese cabbage, old peaches, Ultroios and so on, but, bloggers in the process of use, said that these are not successful, do not know why. A simple and easy-to-use tool is recommended here, Usbwriter, simple and not yet installed.


4. After the production is finished, install it on your machine. Here are the resources for Usbwriter address: Usbwriter

--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------

To install the JDK:

1. In the version of ubuntu14.04 I used earlier, the default is to install openjdk1.8 (do not know from which version), about OPENJDK and JDK differences, is said to be just missing some code, generally use no problem, but for the sake of insurance, or to install the JDK.

2. Later because there is no way to solve the problem, so I reinstall the 12.04 version of Ubuntu, this version will not be installed by default OPENJDK, then installed itself.

3. For the version, it is best to jdk1.6, here to provide Oracle official: jdk1.6 official download (have to spit slot, now download also need to log in, and so later, Java will not be charged? ), for convenience, here is a: jdk1.6

3. For the installation of the JDK, we can either use the manual installation or use the automatic download installation.

4. For automatic download installation, we will search separately, here only a manual installation process. Refer to this blog: Install JDK

Problems encountered:

   unpacking ...   checksumming ... Extracting ...   . /jre-6u32-linux-i586.bin:86:./jre-6u32-linux-i586.bin:./install.sfx.5736:not found  Failed to extract the files. Please refer the troubleshooting sections of the installation instructions on the download page for more information.
In the process of installation, it is always unsuccessful, that is because I downloaded the JDK is this: Jdk-6u45-linux-ia64.bin, if you directly use the resources I provided, should not have this problem.

Let's take a look at the official JDK version:


Although I don't know what Linux Intel Itanium is, I can imagine that my machine is probably not suitable for the JDK version of Linux, and I believe most systems are not.

--------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------

Install the build environment:

1. Before compiling, you need to install some things, because Bo master comparison dishes, still do not know what the installation of what is.

The command is as follows:

sudo apt-get installGnuPG Flex Bison gperf Libsdl1.2-dev Libesd0-dev
sudo apt-get installLibwxgtk2.6-dev squashfs-tools build-essential
sudo apt-get installzlib1g-dev pngcrush schedtool ia32-libs libncurses5-dev

is some compile library, Bo Master does not understand, also will not fraught, this everybody uses a line shell is the same, I too long, pretend to wait for a long time, separate. In the process of installing the compilation environment, Bo Master did not encounter any problems, at least in the 12.04 version of Ubuntu above is not, if you encounter, then have to solve their own specific.

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------

problem resolution during installation of the compilation environment (due to the fact that no issues were encountered in version 12.04, the following documented issue is occurring on the 14.04 release):

1. Reading the package list ... Complete
Analyzing Dependency tree for Package
Reading status information ... Complete
E: Package not found Libwxgtk2.6-dev
E: Unable to find any packages according to regular expression Libwxgtk2.6-dev

FIX: Version changed, 2.6 modified to 2.8 Yes


2. Reading the package list ... Complete
Analyzing Dependency tree for Package
Reading status information ... Complete
There is no package ia32-libs available now, but it is referenced by other packages.
This may mean that the missing package may have been discarded,
Or can only be found in other publishing sources
However, the following packages replace it:
LIB32Z1 lib32ncurses5 lib32bz2-1.0

FIX: sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0


3.tar ZXVF FileName.tar.gz
Ubuntu decompression Error Tar: Due to previous error, will exit with the last error state.


Workaround: In this case, you can first consider using the
Gunzip filename.gz
or gzip-d filename.gz.
command to unzip the. tar.gz file into a. tar file.
Then use the tar xvf Filename.tar file to extract it.
If the problem still occurs, use the following command to view the compression package properties.
File XXXX.tar.gz
See if it's bzip2, or gzip or something, then unzip it accordingly.
But the result is still a problem: no way, have to use the Archive Manager on the desktop to extract, and then move to the specified directory.

4. There is no problem solved in ubuntu14.04, but there is no problem in 12.04: everyone to see my post is good: http://bbs.csdn.net/topics/390955994

Resolution: unresolved, resolved by reloading the system version.

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------

To compile:

Once the above preparations have been completed, you can start compiling the source code using the following command:

source./build/envsetup.sh
Make

At this time, your shell command should be in your source root directory, such as Blogger's in:/usr/local/android/android2.3.7

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------

Problem solving during compilation:

1.find: ' frameworks/base/frameworks/base/docs/html ': No such file or directory

Find: ' Out/target/common/docs/gen ': No such file or directory find: ' frameworks/base/frameworks/base/docs/html ': no such File or directory find: ' Out/target/common/docs/gen ': No such file or directory find: ' Frameworks/base/frameworks/base/do Cs/html ': No such file or directory find: ' Out/target/common/docs/gen ': No such file or directory find: ' frameworks/base/f Rameworks/base/docs/html ': No such file or directory find: ' Out/target/common/docs/gen ': No such file or directory find: '  Frameworks/base/frameworks/base/docs/html ': No such file or directory find: ' Out/target/common/docs/gen ': no such file or Directory

Workaround: Create the appropriate folder in the appropriate location. Find does not affect the results of the compilation.


2.<command-line>:0:0: Warning: "_fortify_source" redefined [enabled by default]

Solution: http://blog.csdn.net/vrix/article/details/8330135

3./USR/BIN/LD cannot Find-lz, Collect2:ld returned 1 exit status

Workaround: The general workaround is: $ sudo apt-get install Zlib1g-dev

But my display is the latest version.

Installing Lib32z1-dev got me past it

Reference: Http://stackoverflow.com/questions/3373995/usr-bin-ld-cannot-find-lz


4.make: * * * [OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/ADB_INTERMEDIATES/ADB]

Solution: The general solution is: $sudo apt-get install Libncurses5-dev

But it shows I'm in the latest version.

FIX: sudo apt-get install Lib32ncurses5-dev

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------

The following is waiting, know that the compilation is successful, may be because I compiled for the 2.3.7 source, smaller, so I think the speed is very fast, about one hours.

--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------

To run the emulator:

Export path= $PATH:/usr/local/android/android2.3.7/out/host/linux-x86/bin

Export Android_product_out=/usr/local/android/android_2.3.7/out/target/product/generic

Emulator

Wait a minute ...


Simulator run successfully, very happy Ah! ~

For compiling other things, such as the Linux kernel and so on, will be published later in the form of blog! ~good luck!

Rookie takeoff: The first time to compile Android source on Ubuntu

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.