Build Android 5.0 Lollipop on OSX 10.10 Yosemite

Ramin Mahmoodi
Jan 16, 2015 · 7 min read

Why have this guide?


Let’s get to it.

What you have to have:

What you should have:


Configuring your Mac

Getting Xcode

Image for post
Image for post
Show package contents of Xcode 5.1.1
$ sudo mkdir -p /Developer/SDK
# Enter your password (this is the password used to install Apps)
Image for post
Image for post
Location of the 10.8 SDK we need to copy over
Image for post
Image for post
Select Xcode 5.1.1 for Command Line Tools

Install MacPorts

$ vim ~/.bash_profile
export PATH=/opt/local/bin:$PATH
$ . ~/.bash_profile
$ port
$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg

Install the Java Development Kit


Install Repo

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Setup file descriptors

$ vim ~/.bash_profile
~~~~~
# set the number of open files to be 1024
ulimit -S -n 1024
$ . ~/.bash_profile

Create a case sensitive virtual drive

$ hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g ~/android.dmg
$ hdiutil attach ~/android.dmg -mountpoint /Volumes/android
$ vim ~/.bash_profile
function mountAndroid { hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android; }
$ mountAndroid

Downloading the source files

$ cd /Volumes/android
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.0_r7.0.1
$ repo sync
Image for post
Image for post
After the branch has been synced!

The part you’ve been waiting for, building the source!

$ lunch
$ make -j4
Image for post
Image for post
Build completed successfully!

Launch your hard work!

$ emulator
Image for post
Image for post
Emulator first run
Image for post
Image for post
Android Version 5.0

Ending…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store