Brief description
Now the Android application development Open source project feels like the spring and Autumn Period, a variety of ideas springing up, blossoming, such as algorithms, shapes, such as databases, such as network protocols, the evil spirit is good-looking,Github Also become open source and beneficiaries of paradise, now we follow the footsteps of open source, follow the dazzling star, standing on the shoulders of giants, to open our path of growth.
Android Source of open source, but also the largest open source, of course, some people will say is open is not open source, this we do not care about, can download to the system code we need, has been very good. Android Source code download compilation for beginners still have a headache, let's start from here.
Download installationVMSvirtual machines andUbuntu iOSfile
The version I chose here is 7.1.5 build-491717, ubuntu-11.04-desktop-i386
Preparation environment
Originally, the choice is 4.4.1 version of the source code, but the source is too large, are more than I set the virtual machine hard disk 50G, decisively give up, estimated that the compilation will take a long time. Then chose the 2.3.1 version of the source code, download the source code before the first to do some preparatory work
Buy a stable VPN, this is the download source code and the required software
Installing the Git tool
sudo apt-get install Git-core GnuPG
Installing the Jdk
The following commands for adding and updating software sources are often used
sudo add-apt-repository Ppa:ferramroberto/java
sudo apt-get update
Installation
sudo apt-get install Sun-java6-jre sun-java6-plugin
sudo apt-get install SUN-JAVA6-JDK
Download repo, and set permissions
wget Https://dl-ssl.google.com/dl/googlesource/git-repo/repo
chmod 777 Repo
CP repo/bin/
Create an Android folder and switch to it directory
mkdir Android
CD Android
DownloadAndroidSource Code
The default is to download the latest version
Repo init -u https://android.googlesource.com/platform/manifest
I'm the version branch that specified the 2.3.1 .
Repo init -u https://android.googlesource.com/platform/manifest-b android-2 . 3 . 1_r1
And then it's downloaded.
Repo Sync
Download is a very long process, the speed is stable, can turn over the wall, roughly two or three days, the total size of 4~5g Bar, fast words, may not be so long
All right, the download is done like
Makecompiling
Make
When downloaded, do not think it is over, the problem has just begun, hehe. Why do you say that, because the compile time will encounter a variety of problems, mainly 2 aspects:
Prompt for error message you is attempting to build on a 32-bit system.
Let's just comment out the script that checks if it's a decimal place.
Modify the main.mk file in the build/core directory:
ifeq ($ (build_os), Linux)
Build_arch: = $ (Shell uname-m)
#Change the following line for building on a 32-bit system.
#ifneq (64,$ (findstring 64,$ (build_arch)))
#$ (warning************************************************)
#$ (warning you is attempting to build on a 32-bit system.)
Locate the following file, and also comment out:
/external/clearsilver/cgi/android.mk
/external/clearsilver/cs/android.mk
/external/clearsilver/java-jni/android.mk
/external/clearsilver/util/android.mk
Modify Local_cflags and the Local_ldflags variables:
# This forces a 64-bit build for JAVA6
# change the following and lines for building on a 32-bit system.
# Local_cflags + =-m64
# Local_ldflags + =-m64
The second problem is that all kinds of software are not installed.
So it is best to install these software before compiling, or compile large half-day out of the problem still have to, start again, that call a Mulberry heart ah.
sudo apt-get install Bison
sudo apt-get install Bison flex
sudo apt-get install Zlib-devel
sudo apt-get install Libncurses5-dev
sudo apt-get install Libx11-dev
sudo apt-get install Gperf
For other similar problems, Baidu look at the lack of which, and then execute a bit better, if not find this, find him in which source inside, add him to our software source files, and then initialize again.
OK, here is the output of make successful after the message, watching is not very excited, hehe
EmulatorLaunch Simulator
This is a much simpler step, adding our compiled output bin to the environment variable
Export path= $PATH: ~/android/out/host/linux-x86/bin
Export Android_product_out=~/android/out/target/product/generic
Run emulator
Emulator
Here is our long-awaited interface, see this, the front of the pay has been paid
PS: Editing the text is really troublesome, the world came to various styles have gone, also do not support offline editing, hey.
Android Source code compilation