Hi, Guest! Login / Register

Deals: How to buy a brand new original iPhone, Samsung Galaxy, Google Pixel, Macbook and more for less than $2... LEARN MORE (Mar, 2018)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[Tutorial] How to download Android source in Ubuntu

(This post was last modified: 01-12-2015, 10:36 PM by hovatek. )

First of all, you need to have Ubuntu setup (for Windows users, see https://forum.hovatek.com/thread-1004.html )

Installing Repo

To install Repo, Launch the Terminal (Ctrl+Alt+T)

1. Make sure you have a bin/ directory in your home directory and that it is included in your path:

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

2. Download the Repo tool and ensure that it is executable:

$ sudo apt-get install curl
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Initializing a Repo client

After installing Repo, set up your client to access the Android source repository:

1. Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive file system. Give it any name you like:


2a. Install Git. After it finishes downloading, you will have Git installed and ready to use.

sudo apt-get install git-core

2b. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

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

For CyanogenMod sources, use

$ repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0

3. When prompted, configure Repo with your real name and Gmail address using

git config --global user.email YourEmail
git config --global user.name YourName

To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.
A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.

Downloading the Android Source Tree

To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run

$ repo sync

you could also use

repo sync -c -j4

-j instruct repo to download several projects in parallel (making it faster). You should tune the number of jobs repo will launch in paralell with regards of your number of CPU cores, and your bandwidth. -j 16 should be fine for a 8-cores box with a high Internet bandwidth.

-c  Ensures repo will only download the revision (branch) that is specified in the manifest, not all the branches that are on the remote server. It will thus save us quite some space, and again it will take less time to download.
Need further assistance? Speak with a Hovatek Representative:
Working Hours: Mondays - Saturdays ; 09:00 - 18:00 (GMT +1:00)
how can i create a bin directory in my home directory
(02-11-2015, 04:34 PM)suheli Wrote: how can i create a bin directory in my home directory

thats what the first command does
Need further assistance? Speak with a Hovatek Representative:
Working Hours: Mondays - Saturdays ; 09:00 - 18:00 (GMT +1:00)

Users browsing this thread:
1 Guest(s)