---
title: "How to download the android 5.0 source code"
author: "bravewu"
date: "2014-11-10T03:26:54Z"
tags: []
categories: ["移动开发"]
slug: "how-to-download-the-android-5-0-source-code"
draft: false
lastmod: "2014-11-12T16:28:27Z"
id: 2153976
url: "https://bradoo.iteye.com/blog/2153976"
---

**Step 1: Install ubuntu 14.04 amd64**

1\. Download the ubuntukylin‐14.04‐desktop‐amd64.iso in the ubuntu website or other site

2\. Make a boot disk with the iso file

3\. Install the ubuntu with boot disk

 

**Step 2: Install oracle-java6-jdk**

```
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
```

It'll keep your java 6 installation up to date.

To automatically set up the Java 6 environment variables JAVA\_HOME and PATH:

```
sudo apt-get install oracle-java6-set-default
```

**Step 3: Install all the neccessary packages**

sudo apt-get install  git-core flex bison gperf build-essential curl libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386

 

**Step 4: Create a link to the libGL.so**

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

 

**Step 5: Create bin path and add it into the PATH envionment variable**

mkdir ~/bin

PATH=~/bin:$PATH

 

**Android main in GIT:** [http://android.github.io/](http://android.github.io/ "http://android.github.io/")

**Android repository index in GIT:** [https://github.com/android](https://github.com/android "https://github.com/android")

 

**Step 6: Download the repo file and grant proper permission**

curl "https://github.com/android/tools\_repo/blob/master/repo" &gt;~/bin/repo

chmod 755 ~/bin/repo

 

**Step 7: Create android source directory and chagne the path to it.**

mkdir -p ~/android/lollipop

cd ~/android/lollipop

 

**Step 8: Congiure your email and name**

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

 

**Step 9: Check all the branch**

git ls-remote --tags https://github.com/android/platform\_manifest

**Step 10: Initialize the repo**

repo init -u https://github.com/android/platform\_manifest -b android-5.0.0\_r2

 

**Step 11: Update the manifest.xml**

1、vim .repo/manifest.xml

2、将属性fetch的值修改为"git://Android.git.linaro.org/"

 

**Step 12: Download the source code**

repo sync