在下載Android源碼的時候,參照Android官方的文檔,我的是mac的虛擬機,按照該頁面的步驟http://source.android.com/source/initializing.html。Setting up a Mac OS X build environment。
先創建一個40g的硬盤,大小寫敏感的,日誌的。不用寫命令,在mac有ui工具可完成,很方便。
然後
export PATH=/opt/local/bin:$PATH
$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg
-
Edit
/opt/local/etc/macports/sources.conf
and add a line that saysfile:///Users/Shared/dports
above the rsync line. Then create this directory:
$ mkdir /Users/Shared/dports
-
In 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/dports
-
Finally, install the old version of gmake with
$ sudo port install gmake @3.81
To increase the cap, add the following lines to your
~/.bash_profile
:ulimit -S -n 1024
這一切都很順利,然後下載代碼:
$ mkdir ~/bin $ PATH=~/bin:$PATH
$ curl https://android.git.kernel.org/repo > ~/bin/repo
這一步,出錯了,下載的repo是個not found的文件,直接打開https://android.git.kernel.org/repo,發現確實是not found啊,鬱悶,沒有repo後面的步驟都無法進行了,再在google搜索類似問題,得到正解,被屏蔽了,不過有個鏡像站點,可以用。https://www.codeaurora.org/gitweb/quic/la/
裏面可以找到repo,既然android.git.kernel.org被屏蔽,後面使用該地址的都會出錯,於是把Repo的REPO_URL改爲git://codeaurora.org/tools/repo.git,如下:
#REPO_URL='git://android.git.kernel.org/tools/repo.git'
REPO_URL='git://codeaurora.org/tools/repo.git'
附件是我改好的Repo,可以直接下載使用 。
現在開始把
$ repo init -u git://android.git.kernel.org/platform/manifest.git
改爲
$ repo init -u git://
codeaurora.org/platform/manifest.git
即可。
然後
$ repo sync
就行了!