下载、编译Android源码简明版

下载、编译Android源码

一、环境准备

  • 1.安装ubuntu
  • 2.安装完整版vi

sudo apt-get remove vim-common

sudo apt-get install vim

  • 3.安装jdk1.6.0

chmod mkdir /usr/lib/jvm/java/

sudo chmod a+x /usr/lib/jvm/java/jdk-6u45-linux-x64.bin

sudo vi /etc/profile

export JAVA_HOME=/usr/lib/jvm/java/jdk1.6.0_45
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin:${JRE_HOME}/bin

source /etc/profile

java -version

  • 4.安装

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

  • 5.安装依赖包

sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx-lts-Trusty:i386\ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386

  • 6.创建链接

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so

下载Android源码

To install Repo: * 1.保证在~ 目录下有一个bin目录,并将其加入到环境变量PATH中,后面一部需要将repo工具放入该bin目录中

$ mkdir ~/bin

$ PATH=~/bin:$PATH

  • 2. 下载Repo工具,并保证其实可执行的:

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

  • 3.初始化一个repo文件目录,WORKING_DIRECTORY就是源码下载的目录

$ mkdir WORKING_DIRECTORY

$ cd WORKING_DIRECTORY

  • 4.download initial

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

或者

repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r2

Android版本代号

username@ubuntu:~/Android-Lollipop$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r3

Your identity is: username [email protected] If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):

black red green yellow blue magenta cyan white

bold dim ul reverse

Enable color display in this user account (y/N)? y

repo has been initialized in /home/username/Android-Lollipop

  • 5 输入命令repo sync, 然后就开始下载了

$ repo sync

三、编译

  • 1.环境

$ source build/envsetup.sh

  • 2.lunch

$ lunch

  • 3.choose

四 腾讯专用网络代理设置

  • 1. 在System Settings中找到NetWork,选择Network proxy,设置proxy模式为“automatic”,Configuration url为

http://txp-01.tencent.com/proxy.pac

  • 2. sudo vi /etc/apt/apt.conf.d/01proxy (如果该文件不存在, 就新建一个), 添加:

Acquire::http { Proxy "http://proxy.tencent.com:8080"; };

  • 3. 设置http、https和ftp代理,一般写在文件.bashrc中,也可以直接敲在终端命令行。

export http_proxy="http://web-proxyhk.oa.com:8080/"

export ftp_proxy="ftp://web-proxyhk.oa.com:8080/"

export https_proxy="https://web-proxyhk.oa.com:8080/"


你可能感兴趣的:(下载、编译Android源码简明版)