基本按照官网指示做就可以了。
Mac OS (Intel/x86)
- Android 6.0 (Marshmallow) - AOSP master: Mac OS v10.10 (Yosemite) or later with Xcode 4.5.2 and Command Line Tools
- Android 5.x (Lollipop): Mac OS v10.8 (Mountain Lion) with Xcode 4.5.2 and Command Line Tools
- Android 4.1.x-4.3.x (Jelly Bean) - Android 4.4.x (KitKat): Mac OS v10.6 (Snow Leopard) or Mac OS X v10.7 (Lion) and Xcode 4.2 (Apple's Developer Tools)
- Android 1.5 (Cupcake) - Android 4.0.x (Ice Cream Sandwich): Mac OS v10.5 (Leopard) or Mac OS X v10.6 (Snow Leopard) and the Mac OS X v10.5 SDK
这里要留意的是 xcode的版本, 要对应上,太高版本可是有麻烦的。
本人编译 5.1.1, 使用 xcode 5.1 通过, 使用xcode 7.x 就不行。
下载xcode dmg
Save the actual path $ xcode-select -p # Set new path $ sudo xcode-select -s /Volumes/Xcode/Xcode.app/Contents/Developer
mac 的文件系统默认是存储大写,但大小写不敏感的。
android 编译需要 敏感的系统,于是要创建一个
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 200g ~/android.dmg
(hdiutil resize -size <new-size-you-want>g ~/android.dmg.sparseimage)
然后mount上去
加在 ~/.bash_profile
ulimit -S -n 1024
function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
function umountAndroid() { hdiutil detach /Volumes/android; }
安装 MacPorts
xcode-select -install
xcodebuild -license
下载 pkg 执行安装
POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg
To install Repo:
-
Make sure you have a bin/ directory in your home directory and that it is included in your path:
$ mkdir ~/bin
$ PATH=~/bin:$PATH -
Download the Repo tool and ensure that it is executable:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/reporepo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r30
repo sync
make clobber
source build/envsetup.sh
lunch aosp_arm-eng
make -j4
android studio 查看代码
mmm development/tools/idegen/
./development/tools/idegen/idegen.sh