Mac下配置android开发环境以及下载android源码,

配置android环境

http://blog.csdn.net/zcljy0318/article/details/6867565

http://source.android.com/source/initializing.html


touch .bash_profile

open .bash_profile

export PATH=$PATH:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/tools:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/platform-tools

##
hdiutil attach ~/android.dmg.sparseimage  -mountpoint /Volumes/android;

----------Android下载源码


查看android源码所有分支:

https://android.googlesource.com/platform/manifest/+refs

下载repo

具体地址参考:

http://source.android.com/source/downloading.html#installing-repo

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
权限:

chmod a+x ~/bin/repo

创建和挂在磁盘

hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g ~/android.dmg.sparseimage

hdiutil attach ~/workspace/android.dmg.sparseimage -mountpoint ~/android;

准备工作:

创建bin目录

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

向PATH中添加bin路径:
export PATH=$PATH:~/bin

.bash_profile内容备份:

export PATH=$PATH:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/tools:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/platform-tools
export PATH=/opt/local/bin:$PATH
export PATH=$PATH:~/bin
function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
##
#hdiutil attach ~/android.dmg.sparseimage  -mountpoint /Volumes/android;
##
# Your previous /Users/apple/.bash_profile file was backed up as /Users/apple/.bash_profile.macports-saved_2015-01-11_at_09:36:20
##

# MacPorts Installer addition on 2015-01-11_at_09:36:20: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.


new:

export PATH=$PATH:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/tools:/Users/apple/Documents/Tools/IDE/adt-bundle-mac-x86_64-20131030/sdk/platform-tools
export PATH=/opt/local/bin:$PATH
export PATH=$PATH:~/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home

##function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
##
hdiutil attach ~/android.dmg.sparseimage  -mountpoint /Volumes/android;
##
# Your previous /Users/apple/.bash_profile file was backed up as /Users/apple/.bash_profile.macports-saved_2015-01-11_at_09:36:20
##

# MacPorts Installer addition on 2015-01-11_at_09:36:20: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

# set the number of open files to be 1024
ulimit -S -n 1024


开始下载源代码:

参考地址:http://blog.csdn.net/yangblocker/article/details/9673097

http://blog.csdn.net/tuhuolong/article/details/41359227

http://www.cnblogs.com/liuqxFuture/archive/2012/12/18/2823717.html


防止repo sync中中断脚本:

#!/bin/sh
repo sync -j4
while [ $? -ne 0 ]
do
repo sync -j4
done

查看android源代码各个分支:

https://android.googlesource.com/platform/manifest/+refs


repo init -u https://android.googlesource.com/platform/manifest -b   tag名称

即可以下载代码。

我在mac 环境下,Xcode 4.6编译4.4的代码和5.0的代码都成功过。Xcode的版本不能过高。



编译完成后一共56G。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值