Getting Started with Android


If you plan to port Android to a MIPS based SoC or platform you will need the following environment setup:

A Linux Development Machine

Android application can be done on either Windows or Linux but developing an Android operating system for a phone or other hardware platform can only be done on Linux.  You must have a Linux workstation running 64-bit Ubuntu version 10.04 or later.

You can download Ubuntu for free from http://www.ubuntu.com.  You can also purchase workstations and laptops with Ubuntu factory installed.

You will need to install several tools which are described in the following instructions, please use bash.

Required Packages

After your Ubuntu machine is running you will need to install the following packages.

Before you can install the necessary packages four lines must be added to the /etc/apt/sources.list file on your Ubuntu machine. In the following instructions we will use the pico editor to add the necessary four lines.

Open a terminal and type the following:

sudo pico -w /etc/apt/sources.list

At the end of the file add the following four lines:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

Save the file and proceed to the next steps.

For Android “Froyo” Development follow these instructions:

Note that Froyo development requires Java 5 be installed on the development machine.  Java 5 is not the latest version of Java and most Linux workstations will require an older version to be installed.  The following instuctions include installation of Java 5.

Open a terminal and type the following:

sudo apt-get update
sudo apt-get install curl
sudo apt-get install git-core
sudo apt-get install bison
sudo apt-get install sun-java5-jdk
sudo apt-get install g++
sudo apt-get install flex
sudo apt-get install gperf
sudo apt-get install zlib1g-dev
sudo apt-get install libncurses5-dev
sudo apt-get install xorg-dev

For Android “Gingerbread” and “Ice Cream Sandwich” follow these instructions:

Note that Gingerbread and Ice Cream Sandwich development requires Java 6 be installed on the development machine.  The following instuctions include installation of Java 6.
Open a terminal and type the following:

sudo apt-get install curl
sudo apt-get install git-core
sudo apt-get install bison
sudo apt-get install sun-java6-jdk
sudo apt-get install g++
sudo apt-get install g++-multilib
sudo apt-get install flex
sudo apt-get install gperf
sudo apt-get install zlib1g-dev
sudo apt-get install libncurses5-dev
sudo apt-get install xorg-dev
sudo apt-get install libgl1-mesa-dev

Check Your Version of Java

Verify that you have the correct version of Java installed on your workstation

  • Java 5 (1.5..xxx) for Froyo development
  • Java 6 (1.6.xxx) for Gingerbread and Ice Cream Sandwich development

Open a terminal and type the following:

java -version

The return message will tell you which Java version is installed.

Version Control Tools

To work with the Android code, you will need to use both Git and Repo which need to be installed on your system.

  • Git is an open-source version-control system designed to handle very large projects that are distributed over multiple repositories. In the context of Android, Git is used for local operations such as local branching, commits, diffs, and edits.
  • Repo is a tool that was built on top of Git. Repo helps manage the many Git repositories, does the uploads to the revision control system , and automates parts of the Android development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The “repo” command is an executable Python script that you can put anywhere in your path.

In working with the Android source files, you will use Repo for dowloading source code.

Create a ~/bin directory in your home directory, and add this directory to your path.  From a terminal window type:

cd ~
mkdir bin
sudo pico -w /etc/environment

Add the following to the end of the “PATH” line

:~/bin

Save the file and exit the pico editor, now type the following

curl http://android.git.kernel.org/repo  > ~/bin/repo
chmod a+x ~/bin/repo

Android Source

Once your development machine setup is completed you can now download the Android source code.  Click here for instuctions on downloading the source code.