Build android5.1 build Environment under Ubuntu14.04

Source: Internet
Author: User
Tags using git

Official online tutorial: http://source.android.com/source/building.html, basically follow this step by step.

First, the initialization of the configuration

1. Install Jdk7 (5.1 requires OPENJDK7, other versions see documentation)

$ sudo apt-get update$ sudo apt-get install OPENJDK-7-JDK

Update the default JDK version

$ sudo update-alternatives--config java$ sudo update-alternatives--config javac

2.1404 dependencies required for download

sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip

I'm having the following error

The following packages have unsatisfied dependencies: G++-multilib: Dependent: gcc-multilib (>= 4:4.8.2-1ubuntu6) but it will not be installed                dependent: g++ (>= 4:4.8.2-1ubuntu6) but Yes it will not be installed E: cannot fix the error because you require certain packages to remain current, that is, they destroy the dependencies between the software packages

Install Gcc-multilib and g++ separately:

sudo apt-get install g++sudo apt-get Install Gcc-multilib

3. Configure USB access rights

To create a new/etc/udev/rules.d/51-android.rules file, you can use sudo gedit/etc/udev/rules.d/51-android.rules to add the following code:

# ADB protocol on Passion (Nexus one) subsystem== "USB", attr{idvendor}== "18d1", attr{idproduct}== "4e12", mode= "0600" , owner= "<username>"# FastBoot protocol on Passion (Nexus one) subsystem==" USB ", attr{idvendor}==" 0bb4 ", attr{idproduct}==" 0fff ", mode= "0600", owner= "<username>"# ADB protocol on CRESPO/CRESPO4G (Nexus S) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4e22 ", MODE = "0600", owner= "<username>"# FastBoot protocol on CRESPO/CRESPO4G (Nexus S) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4e20 " , mode= "0600", owner= "<username>"# ADB protocol on Stingray/wingray (Xoom) subsystem==" USB ", attr{idvendor}==" 22b8 ", attr{idproduct}==" 70a9 ", mode= "0600", owner= "<username>"# FastBoot protocol on Stingray/wingray (Xoom) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 708c ", Mode= "0600", owner= "<username>"# ADB protocol on Maguro/toro (Galaxy Nexus) subsystem==" USB ", attr{idvendor}==" 04e8 ", attr{idproduct}==" 6860 ", Mode= "0600", owner= "<username>"# FastBoot protocol on Maguro/toro (Galaxy Nexus) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4e30 ", mode=" 0600 ", owner="<username>"# ADB protocol on Panda (PandaBoard) subsystem==" USB ", attr{idvendor}==" 0451 ", attr{idproduct}==" d101 ", mode=" 0600 ", owner="<username>"# ADB protocol on Panda (PandaBoard ES) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" d002 ", mode=" 0600 ", owner="<username>"# FastBoot Protocol on Panda (PandaBoard) subsystem==" USB ", attr{idvendor}==" 0451 ", attr{idproduct}==" d022 ", MODE = "0600", owner= "<username>"# Usbboot Protocol on Panda (PandaBoard) subsystem==" USB ", attr{idvendor}==" 0451 ", attr{idproduct}==" d00f ", mode=" 0600 ", owner="<username>"# Usbboot Protocol on Panda (PandaBoard ES) subsystem==" USB ", attr{idvendor}==" 0451 ", attr{idproduct}==" d010 ", MODE = "0600", owner= "<username>"# ADB protocol on Grouper/tilapia (Nexus 7) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4e42 ", MODE = "0600", owner= "<username>"# FastBoot protocol on Grouper/tilapia (Nexus 7) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4e40 " , mode= "0600", owner= "<username>"# ADB protocol on Manta (Nexus Ten) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4ee2 ", mode=" 0600 ", Owner= "<username>"# FastBoot protocol on Manta (Nexus Ten) subsystem==" USB ", attr{idvendor}==" 18d1 ", attr{idproduct}==" 4ee0 ", mode=" 0600 ", owner="<username>"

The <username> is then replaced with the system's user name.

4. Configure the output directory

Export out_dir_common_base=<path-to-your-out-directory>

5. Set CCache

Export use_ccache=1

It is stored by default in ~/.ccache and is specifically specified if it is an NFS file system:

Export ccache_dir=<path-to-your-cache-directory>

Recommended cache size 50-100g, after downloading the source code to execute:

Prebuilts/misc/linux-x86/ccache/ccache-m 50G

Environment configuration is complete, then download the source code.

Second, the source code download

1. Installing Repo

Create a new bin directory and add it to the environment variable:

$ mkdir ~/bin$ Path=~/bin: $PATH

Download repo

$ Curl Https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo$ chmod a+x ~/bin/repo

Due to the domestic wall, Google may not be able to download, it is recommended to use Tsinghua AOSP source download:

git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/

Copy to the bin directory and add permissions:

CP Git-repo/repo ~/bin/
chmod a+x ~/bin/repo

To modify the repo file, set Repo_url as follows:

Repo_url = ' Git://aosp.tuna.tsinghua.edu.cn/android/git-repo '

2. Initialize Repo

Create Source Download directory:

$ mkdir ~/source$ CD ~/srouce

Initialize Repo

$ repo Init-u https://android.googlesource.com/platform/manifest

Google can not connect with this:

Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest

This command downloads the latest version of the master branch by default, at this point 5.1, if you want to specify a version, add-B, as follows:

$ repo init-u https://android.googlesource.com/platform/manifest-b ANDROID-4.0.1_R1
Each version is named as follows:
Build Branch Version supported deviceslmy47z android-5.1.1_r4 Lollipop Nexus 6 (for Sprint, USC only) Lmy 48B android-5.1.1_r3 Lollipop Nexus 5lmy47x android-5.1.1_r2 Lollipop Nexus 9 (volantis) lmy47v Androi D-5.1.1_R1 Lollipop Nexus 7 (Flo/grouper), Nexus Ten, Nexus playerlmy47o ANDROID-5.1.0_R5 Lollipop Nexus 4, Nexus 7 (Flo/deb) lmy47m ANDROID-5.1.0_R4 Lollipop Nexus 6 (for T-mobile only) lmy47i Android-5.1.0_r3 Lollip Op Nexus 5, Nexus 6lmy47e android-5.1.0_r2 Lollipop Nexus 6lmy47d Android-5.1.0_r1 Lollipop Nexus 5, Nexus 6, Nexus 7 (Grouper/tilapia), Nexus Ten, Nexus playerlrx22l ANDROID-5.0.2_R3 Lollipop Nexus 9 (Volantis/vola NTISG) lrx22g Android-5.0.2_r1 Lollipop Nexus 7 (Flo/deb/grouper/tilapia), Nexus 10lrx22c Android-5.0.1_r1 L Ollipop Nexus 4, Nexus 5, Nexus 6 (Shamu), Nexus 7 (Flo), Nexus 9 (VOLANTIS/VOLANTISG), Nexus 10lrx21v android-5.0.0 _r7.0.1 Lollipop NExus Player (fugu) lrx21t android-5.0.0_r6.0.1 Lollipop Nexus 4lrx21r android-5.0.0_r5.1.0.1 Lollipop Nex    US 9 (Volantis) lrx21q android-5.0.0_r5.0.1 Lollipop Nexus 9 (volantis) lrx21p android-5.0.0_r4.0.1 Lollipop Nexus 7 (Flo/grouper), Nexus 10lrx21o android-5.0.0_r3.0.1 Lollipop Nexus 5 (Hammerhead), Nexus 6 (Shamu) LRX21 M android-5.0.0_r2.0.1 Lollipop Nexus Player (fugu) lrx21l android-5.0.0_r1.0.1 Lollipop Nexus 9 (Volanti s) ktu84q android-4.4.4_r2 KitKat Nexus 5 (Hammerhead) (for 2degrees/nz, Telstra/aus and India only) ktu84p Android OID-4.4.4_R1 KitKat Nexus 5, Nexus 7 (Flo/deb/grouper/tilapia), Nexus 4, Nexus 10ktu84m android-4.4.3_r1.1 Kit Kat Nexus 5 (Hammerhead) ktu84l android-4.4.3_r1 KitKat Nexus 7 (Flo/deb/grouper/tilapia), Nexus 4, Nexus 10KVT 49L ANDROID-4.4.2_R2 KitKat Nexus 7 (Deb Verizon) kot49h android-4.4.2_r1 KitKat Nexus 5, Nexus 7 (flo/de B/grouper/tilapia), Nexus 4, Nexus 10kot49e ANDROID-4.4.1_R1 KitKat Nexus 5, Nexus 7 (Flo/deb/grouper/tilapia), Nexus 4, Nexus 10krt16s    android-4.4_r1.2 KitKat Nexus 7 (Flo/deb/grouper/tilapia), Nexus 4, Nexus 10krt16m ANDROID-4.4_R1 KitKat Nexus 5 (Hammerhead) jls36i android-4.3.1_r1 Jelly Bean Nexus 7 (deb) jls36c android-4.3_r3 Jelly Bean Nex US 7 (Deb) jss15r android-4.3_r2.3 Jelly Bean Nexus 7 (Flo) jss15q android-4.3_r2.2 Jelly Bean Nexus 7 (fl o) jss15j android-4.3_r2.1 Jelly Bean Nexus 7 (flo/deb) jsr78d android-4.3_r2 Jelly Bean Nexus 7 (Deb) JWR6     6Y android-4.3_r1.1 Jelly Bean Galaxy Nexus, Nexus 7 (Grouper/tilapia), Nexus 4, Nexus 10jwr66v ANDROID-4.3_R1    Jelly Bean Galaxy Nexus, Nexus 7 (Grouper/tilapia), Nexus 4, Nexus 10jwr66n android-4.3_r0.9.1 Jelly Bean    Galaxy Nexus, Nexus 7 (Grouper/tilapia/flo), Nexus 4, Nexus 10jwr66l android-4.3_r0.9 Jelly Bean Nexus 7jdq39e android-4.2.2_r1.2 JElly Bean Nexus 4jdq39b android-4.2.2_r1.1 Jelly Bean Nexus 7jdq39 android-4.2.2_r1 Jelly Bean Galaxy Nexus, Nexus 7, Nexus 4, Nexus 10jop40g android-4.2.1_r1.2 Jelly Bean Nexus 4jop40f android-4.2.1_r1.1 Jel Ly Bean Nexus 10jop40d android-4.2.1_r1 Jelly Bean Galaxy Nexus, Nexus 7, Nexus 4, Nexus 10jop40c android-4 .2_r1 Jelly Bean Galaxy Nexus, Nexus 7, Nexus 4, Nexus 10jzo54m android-4.1.2_r2.1 Jelly Bean jzo54l and ROID-4.1.2_R2 Jelly Bean jzo54k android-4.1.2_r1 Jelly Bean Nexus S, Galaxy Nexus, Nexus 7jro03s Android -4.1.1_r6.1 Jelly Bean Nexus 7jro03r android-4.1.1_r6 Jelly Bean Nexus S 4gjro03o android-4.1.1_r5 Je lly Bean Galaxy nexusjro03l android-4.1.1_r4 Jelly Bean Nexus sjro03h android-4.1.1_r3 Jelly Bean JRO 03E android-4.1.1_r2 Jelly Bean Nexus sjro03d android-4.1.1_r1.1 Jelly Bean Nexus 7jro03c android-4.1 .1_r1 Jelly Bean GAlaxy nexusimm76l android-4.0.4_r2.1 ice Cream Sandwich imm76k android-4.0.4_r2 Ice Cream Sandwich Gala XY nexusimm76i android-4.0.4_r1.2 ice Cream Sandwich Galaxy nexusimm76d android-4.0.4_r1.1 ice Cream Sandwi CH Nexus S, Nexus S 4G, Galaxy NexusIMM76 android-4.0.4_r1 Ice Cream Sandwich IML77 android-4.0.3_r1.1 I Ce Cream Sandwich iml74k android-4.0.3_r1 ice Cream Sandwich Nexus sicl53f android-4.0.2_r1 ice Cream Sa Ndwich Galaxy nexusitl41f android-4.0.1_r1.2 Ice Cream Sandwich Galaxy nexusitl41d android-4.0.1_r1.1 Ic    E Cream Sandwich Galaxy nexusitl41d android-4.0.1_r1 Ice Cream Sandwich Galaxy NexusGWK74 Android-2.3.7_r1    Gingerbread Nexus S 4ggrk39f android-2.3.6_r1 Gingerbread Nexus One, Nexus sgrk39c android-2.3.6_r0.9 Gingerbread Nexus SGRJ90 Android-2.3.5_r1 Gingerbread Nexus S 4ggrj22 android-2.3.4_r1 Gingerbread N Exus One, Nexus S, Nexus S 4ggrj06d android-2.3.4_r0.9 Gingerbread Nexus S 4ggri54 android-2.3.3_r1.1 Gingerbread Nexus SGRI40 Android-2.3.3_r1 Gingerbread Nexus One, Nexus sgrh78c Android-2.3.2_r1 Gingerbread Nexus SGRH78 Androi    D-2.3.1_r1 Gingerbread Nexus SGRH55 android-2.3_r1 Gingerbread earliest gingerbread version, Nexus sfrk76c ANDROID-2.2.3_R2 Froyo FRK76 android-2.2.3_r1 Froyo frg83g android-2.2.2_r1 Froyo Nexus ONEFRG    83D android-2.2.1_r2 Froyo Nexus OneFRG83 android-2.2.1_r1 Froyo Nexus onefrg22d android-2.2_r1.3    Froyo frg01b android-2.2_r1.2 Froyo FRF91 android-2.2_r1.1 Froyo Nexus onefrf85b android-2.2_r1 Froyo Nexus oneepf21b android-2.1_r2.1p2 eclair ESE81 android-2.1_r2.1s eclair epe54b android-2. 1_r2.1p Eclair Nexus OneERE27 android-2.1_r2 eclair Nexus OneERD79 android-2.1_r1 Eclair Nexus One ESD56 Android-2.0.1_r1 Eclair ESD20 android-2.0_r1 eclair DMD64 android-1.6_r1.5 Donut DRD20 android-1.6_r1.4         DRD08 android-1.6_r1.3 DRC92 android-1.6_r1.2
View Code

If you are using Git for the first time to prompt for email authentication, enter the following command:

git config--global user.email "[email protected]" git config--global user.name "Your name"

3. Replace the existing AOSP source code remote

If you have previously obtained the source of the AOSP by some means, but you want to be in the future through tuna synchronization, only need to be in the . Repo/manifest.xml

< Remote   name = "Aosp"        fetch= "..."        Review= "https://android-review.googlesource.com/"/>

Switch

      < Remote   name = "Aosp"        fetch= "Git://aosp.tuna.tsinghua.edu.cn/android/"       review= "https:// android-review.googlesource.com/"/>

4. Download the source code

$ repo Sync

This step has to wait a long time. Long... For a long time .... Repo can be seen as an upgrade version of Git, with the ability to continue the breakpoint, so slow down, 5.1 probably under 30G

Build android5.1 build Environment under Ubuntu14.04

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.