mac 终端 shell 下载 android系统源码 方法总结
来源:互联网 发布:身份证复印件软件v3.4 编辑:程序博客网 时间:2024/05/17 21:40
第一次用Mac下载Android源码,遇到过一些问题。下面总结下,记录遇到过得问题
一、配置mac相关环境,具体方法Google有给出
Setting up a Mac OS build environment
1、shell中输入如下命令,创建一个大小写敏感,40g大小的盘,名字后缀可能是.dmg或者.dmg.sparseimage,其中~/android.dmg可以更换位置。我的是生成的android.dmg.sparseimage
# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg如下方式可以调整盘的大小
# hdiutil resize -size <new-size-you-want>g ~/android.dmg.sparseimage在.bash_profile加上如下方法,方便挂载:
# mount the android file imagefunction mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
# unmount the android file imagefunction umountAndroid() { hdiutil detach /Volumes/android; }2、mac的jdk使用oracle的jdk 8u45 or newer
3、安装需要的工具
安装xcode,可以使用如下命令(我没试过),也可以通过app store安装
$ xcode-select --install
在.bash_profile添加路径
export PATH=/opt/local/bin:$PATH
在Install MacPorts中下载macports,并安装;安装完之后需要执行下面的命令,才能使用macports
$ sudo port -d selfupdate通过macports获取gmake,libsdl,git,gnupg
$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg在.bash_profile中添加下面方法,修改文件描述符
# set the number of open files to be 1024ulimit -S -n 1024到这里,mac第一步环境搭建终于完成。
二、下载源码,具体方法Google已给出,但是由于国内导致源码下载失败,这个时候需要借助VPN才行
Downloading the Source
1、安装repo,把bin目录加入PATH
$ mkdir ~/bin在.bash_profile中加入如下命令,和上面的结合一起
export PATH=/opt/local/bin:~/bin:$PATH下载repo
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo$ chmod a+x ~/bin/repo2、进入到前面建好的盘android.dmg.sparseimage进行git配置
$ git config --global user.name "Your Name"$ git config --global user.email "you@example.com"3、重点来了,下载Android源码
$ repo init -u https://android.googlesource.com/platform/manifest国内原因,导致这个地址链接不上,就需要特殊方法获取源码
第一步要一个VPN账号,我使用的Green的VPN,在网络中添加一个VPN的网络
然后按照How to create a VPN connection via terminal?的方法配置shell中的vpn,就可以下载Android源码
具体方法在.bash_profile中添加如下方法,其中VPN(L2TP)2可以改成自己VPN的名字
function vpn-connect {/usr/bin/env osascript <<-EOFtell application "System Events" tell current location of network preferences set VPN to service "VPN(L2TP)2" -- your VPN name here if exists VPN then connect VPN repeat while (current configuration of VPN is not connected) delay 1 end repeat end tellend tellEOF}
function vpn-disconnect {/usr/bin/env osascript <<-EOFtell application "System Events" tell current location of network preferences set VPN to service "VPN(L2TP)2" -- your VPN name here if exists VPN then disconnect VPN end tellend tellreturnEOF}
登录新的shell,首先输入vpn-connect,最后就是下载源码
$ vpn-connect$ repo sync
祝大家下载Android源码顺利。
0 0
- mac 终端 shell 下载 android系统源码 方法总结
- Android 源码下载总结+终端使用代理下载的方法
- mac 系统下android源码下载以及使用(总结)
- MAC 下配置代理用于终端下载Android源码
- android源码下载mac
- Mac下载android源码
- Mac 系统下Android 源码的下载与编译
- Mac环境下载编译Android源码方法记录
- mac系统终端输入tab的方法
- Mac下下载android源码
- mac 下载编译Android源码
- mac shell终端su
- Android系统源码下载
- 下载Android系统源码
- android系统源码下载
- Android系统源码下载
- Android 系统源码下载
- android系统源码下载
- Java类加载原理解析
- 强连通 Tarjan+Kosaraju (HDU1269+hdu3836)
- codeforces451E容斥原理加lucas
- C语言scanf函数详细解释
- Spring自定义全局异常处理器
- mac 终端 shell 下载 android系统源码 方法总结
- hdu 3308 LCIS(线段树)
- unix网络编程源码编译出错分析
- haproxy+mycat 搭建
- spring bean-- autowired的正确用法
- RabbitMQ(一)
- 五、 Objects工具类
- 极光推送开发第一弹——极光推送简单入门
- java学习笔记--基础、类