How to get the Android source code in Mac OS X
http://source.android.com/source/download.html
新增在 Mac OS X 底下, 取得 Android source code 的步驟方法
Mac OS X
To build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.4 (Tiger), 10.5 (Leopard), or 10.6 (Snow Leopard). The Android build system and tools do not support the obsolete PowerPC architecture.
Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+. HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.
Creating a case sensitive disk image
If you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead. To create the image, launch Disk Utility and select "New Image". A size of 8 GB is sufficient, or more if you prefer. Be sure to select "case sensitive, journaled" as the volume format.
This will create a .dmg file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":
function mountAndroid{ hdiutil attach ~/android.dmg-mountpoint /Volumes/android; }
To set up your Mac OS development environment, follow these steps:
- Install XCode from http://developer.apple.com. We recommend version 3.0 or newer. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download.
- Install MacPorts from http://www.macports.org/.
- Make sure that /opt/local/bin appears in your path BEFORE /usr/bin. If not, add
export PATH=/opt/local/bin:$PATHto your ~/.bash_profile.
- Get make, git, and GPG packages from port:
$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupgIf using Mac OS 10.4, also install bison:$ POSIXLY_CORRECT=1 sudo port install bison
- Temporary step: There is a bug in gmake 3.82 that prevents android from building. You can install version 3.81 using MacPorts by taking the following steps:
Edit /opt/local/etc/macports/sources.conf and a line that says
file:///Users/Shared/dportsabove the rsync line. Then create this directory:$ mkdir /Users/Shared/dportsIn the new dports directory, run$ svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/Create a port index for your new local repository:$ portindex /Users/Shared/dportsFinally, install the old version of gmake with$ sudo port install gmake @3.81 - Set an appropriate per-process file descriptor limit. To do this, add the following lines to your ~/.bash_profile:
# set the number of open files to be 1024
ulimit -S -n 1024
===
Checking build tools versions...
build/core/main.mk:70: ************************************************************
build/core/main.mk:71: You are building on a case-insensitive filesystem.
build/core/main.mk:72: Please move your source tree to a case-sensitive filesystem.
build/core/main.mk:73: ************************************************************
build/core/main.mk:74: *** Case-insensitive filesystems not supported. Stop.