Build Android L Development compilation environment

Source: Internet
Author: User

Download, install Ubuntu 12.04
http://releases.ubuntu.com/12.04/


Installing the JDK

Android L version requires OPENJDK 7.0 or more, the KK version requires Oracle JDK 1.6.26 or later

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

Configure the Java version to run by default

    • Run the following command to configure
$ sudo update-alternatives--config java$ sudo update-alternatives--config javac
    • or edit ~/.BASHRC, add the following, need to switch JDK to 1.6 when running directly JAVA6
Java7 () {  export java_home=/usr/lib/jvm/java-7-openjdk-amd64/  export path=${java_home}/bin: $PATH}java6 () {  Export java_home=/home/hunter/tools/jdk1.6.0_38  export Path=${java_home}:${java_home}/bin:${path}}


Install the necessary packages (Ubuntu 12.04)
$ sudo apt-get install git gnupg Flex Bison gperf build-essential   Zip curl Libc6-dev libncurses5-dev:i386 X11proto-cor E-dev   libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386   libgl1-mesa-dev g++-multilib mingw32 Tofrodos   python-markdown libxml2-utils xsltproc zlib1g-dev:i386$ sudo ln-s/usr/lib/i386-linux-gnu/mesa/ Libgl.so.1/usr/lib/i386-linux-gnu/libgl.so


Installation Kit
$ sudo apt-get install-y vim ssh$ sudo apt-get install-y ia32-libs$ sudo apt-get install-y tree


Configuring the SDK

1. Download SKD

Official: Https://developer.android.com/sdk/index.html#Other no need to turn the wall: http://www.androiddevtools.cn/  <--All kinds of magic tools readily

2. Configuring the SDK

Add the following to ~/.BASHRC, which takes effect after the source ~/.BASHRC is executed export android_home=/home/hunter/tools/adt-bundle/sdkexport Android_studio_ Home=/home/hunter/tools/android-studioexport path= $ANDROID _home/tools: $ANDROID _home/platform-tools: $ANDROID _ Studio_home/bin: $PATH


Configure USB connection permissions

1. Create a 70-android.rules file

$ sudo touch/etc/udev/rules.d/70-android.rules

2. Get the vid and PID of the current device

$ lsusbbus 001 Device 001:id 1d6b:0002 Linux Foundation 2.0 root hubbus 002 Device 001:id 1d6b:0001 Linux Foundation 1.1 Root Hubbus 002 Device 002:id 0e0f:0003 VMware, Inc. virtual Mousebus 002 Device 003:id 0e0f:0002 VMware, Inc. virtual USB Hubbus 001 Device 025:id 05c6:903a Qualcomm, Inc.   <== Find Vid (05C6)

3. Add the following to 70-android.rules

subsystem== "USB", attr{idvendor}== "05c6", mode= "0666", group= "Plugdev"  <== VID (05C6)

4. Add executable permissions

$ sudo chmod a+x/etc/udev/rules.d/70-android.rules

5. Restart Udev

$ sudo/etc/init.d/udev Restart

6. Verification


Configure other environments

1. Configure Gitlog Short format display

Add the following to ~/.bashrcalias gitlog= "git log--graph--pretty=format: '%cred%h%creset-%c (yellow)%cd%creset-%cblue%an% Creset-%cgreen%s%creset '--date=short "

2. Configure Git

Run the following command to configure it, or edit ~/.gitconfig directly to configure git config--global user.name "usernmame"//Must be configured-username (mailbox prefix) git config--global User.email "Email"//must config item-email git config--global core.egit config--global core.editor vim//config edit tool for Vimgit config--glob Al Color.ui Auto//configure color Auto git config--global merge.tool vimdiff//Configure diff analysis tool git config--list//view configuration information git config user.name/ /can view an environment variable configuration git config--global alias.ck checkout//Set Alias

3. Configure Git commit information

Edit ~/.gitmessage, add commit, such as: [Bugfix/feature][id]:[type]  BUG [Products]   [solution Description]  [Other Info]  N/A
$ git config--global commit.template ~/.gitmessage

4. Create the SSH key

$ ssh-keygen-t RSA    //All-in-one, no need to create a key password$ cat. Ssh/id_rsa.pub  //A file with the suffix named Pub, which is the public key of the Gerrit account on the machine, If you change that virtual machine you need to create and upload the public key to the Gerrit Web

5. Configure Vim

Add the following to ~/.vimrcset Hlsearchset Numberset tabstop=4

6. Configure Jgrep,cgrep,resgrep, etc., these methods are defined in the build/envsetup.sh file of the Android source code

Add the following to ~/.BASHRC, which takes effect after you execute the source ~/.BASHRC function Ggrep () {find-name. repo-prune-o-name. Git-prune-o-name out-p Rune-o-type f-name "*\.gradle"-print0 | xargs-0 grep--color-n "[email protected]"}function jgrep () {find-name. repo-prune-o-name. Git-prune-o -name out-prune-o-type f-name "*\.java"-print0 | xargs-0 grep--color-n "[email protected]"}function cgrep () {find-name. repo-prune-o-name. Git-prune-o -name out-prune-o-type f \ (-name ' *.c '-o-name ' *.cc "-o-name ' *.cpp '-o-name ' *.h ' \)-print0 | xargs-0 grep--color-n "[email protected]"}function resgrep () {for dir in ' Find-name. Repo-prune-o-name. Git-prune-o-name out-prune-o-name res-type d '; Do find $dir-type f-name ' *\.xml '-print0 | xargs-0 grep--color-n "[email protected]"; Done;} function Mangrep () {find-name. repo-prune-o-name. Git-prune-o-path./out-prune-o-type f-name ' androidmanif Est.xml '-print0 | xargs-0 GREP--color-n "[email protected]"}function sepgrep () {find-name. repo-prune-o-name. Git-prune-o-path./out -prune-o-name Sepolicy-type d-print0 | xargs-0 grep--color-n-R--exclude-dir=\.git "[Email protected]"}

7. Configure the Change-id auto-generation tool

Add the following to the. git/hooks/commit-msg, execute chmod +x. git/hooks/commit-msg Add executable permissions
Script content: Poke a little surprise.


Environmental Inspection
$ adb versionandroid Debug Bridge version 1.0.31
$ Java-versionjava Version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1) OpenJDK 64-bit Server VM (build 24.79-b02, Mixed mode)
$ git--versiongit version 1.7.9.5
$ python--versionpython 2.7.3
$ make--versiongnu make 3.81Copyright (C) 2006 free  software Foundation, inc.this are free software; see the source fo R copying conditions. There is NO warranty; Not even to merchantability or FITNESS for Aparticular PURPOSE. This program built for X86_64-PC-LINUX-GNU

Build Android L Development compilation environment

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.