像我這樣用慣了Windows的人,對Linux還是玩不來的,很簡單的操作對我來說跟剛學電腦一樣,本文主要講在Windows下下載下傳Android源碼的方法,在網上找了很長時間,也費了不少周折,最後實踐成功,将相關步驟整理如下,以供讀者參考。
<a href="http://blog.51cto.com/attachment/201205/200706981.png" target="_blank"></a>
點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/200739381.png" target="_blank"></a>
這裡有三個選項,如果你隻是用來下載下傳Android源碼,隻安裝相關的幾個包,建議選擇“Install from Internet”,如果你要安裝很多包,建議“Download Without Installing”,下載下傳完成後,再次運作時選擇“Install from Local Directory”進行安裝,因為要安裝的檔案大(幾個G),往往在下載下傳過程中會因網絡相關的問題中斷,就比較鬧心了。
繼續點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/201246130.png" target="_blank"></a>
選擇安裝目錄,點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/201431617.png" target="_blank"></a>
這裡選擇下載下傳的安裝檔案存放的目錄,點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/201547904.png" target="_blank"></a>
選擇“直接下載下傳”,點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/201652942.png" target="_blank"></a>
這裡選擇下載下傳站點,國内選擇163就可以了,點選【下一步】:
<a href="http://blog.51cto.com/attachment/201205/201816308.png" target="_blank"></a>
這裡比較重要,要選擇安裝的包,(Default,Install,Uninstall),隻選擇需要的包安裝,要不然要下載下傳很長很長時間。
把下面這幾個裝上就可以了。
Net -> curl;
Devel -> git* (git, git-completion, git-gui, gitk);
Libs -> libreadline7(可能以後還會有8,9等新版本), libiconv2;
Editors -> vim;
Python -> python。
接下來就等待安裝完成了,完成後啟動Cygwin,接下來要建立一個檔案夾存放repo腳本及源碼,路徑不能帶有中文,檔案夾名稱也能有空格,我這裡放到C:\Users\Brant\Documents\workspace\Android_Source_Code下面,啟動Cygwin後,切換到上面的目錄:
按照下面的指令,一條條執行:
cd c://進入C槽
cd Users/Brant/Documents/workspace/Android_Source_Code
mkdir bin //建立bin檔案夾
PATH=/cygdrive/c/Users/Brant/Documents/workspace/Android_Source_Code/bin:$PATH//這裡設定Path,跟Windows下的環境變量意思一樣,要不然找不到repo指令。
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /cygdrive/c/Users/Brant/Documents/workspace/Android_Source_Code/bin/repo,//這個是将Repo腳本檔案下載下傳到bin檔案夾下。
chmod a+x repo //讓repo有執行權限
為了友善區分版本,我在Android_Source_Code下面建立了個android-4.0.1_r1檔案夾,下面要下載下傳這個版本。
進入到建立的 android-4.0.1_r1檔案夾中
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 //此處下載下傳branch為4.0.1_r1版本,如果你要下載下傳master,執行repo init -u https://android.googlesource.com/platform/manifest。
最後執行 repo sync進行同步。
<a href="http://blog.51cto.com/attachment/201205/205005676.png" target="_blank"></a>
這裡要下載下傳幾個G的東西,接下來就慢慢等待了。
本文轉自 breezy_yuan 51CTO部落格,原文連結:http://blog.51cto.com/lbrant/859151,如需轉載請自行聯系原作者