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

来源:互联网 发布:金山恢复软件 编辑:程序博客网 时间:2024/05/22 11:46

配置android环境

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

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


touch .bash_profileopen .bash_profileexport 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.sparseimagehdiutil 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-toolsexport PATH=/opt/local/bin:$PATHexport PATH=$PATH:~/binfunction 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-toolsexport PATH=/opt/local/bin:$PATHexport PATH=$PATH:~/binexport 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 1024ulimit -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/shrepo sync -j4while [ $? -ne 0 ]dorepo sync -j4done

查看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
原创粉丝点击