接手android也有一年的時間了,由於剛開始學習時資料比較少,又大多都是斷章取義的,所以對於android我一直處於似懂非懂的狀態下。今天終於感覺到該留點學習的經驗吧,那就從這篇開始我的android系列文章了。
Android使用Git管理原始碼的,在Linux下我們可以使用ubuntu來擷取系統源碼,下面我就逐步介紹在Windows些如何擷取Android系統源碼了。
一。安裝msysGit
在google的http://code.google.com/p/msysgit/中這樣介紹到:
If you just want to use Git to do your version control in Windows, you will need to download Git for Windows, run the installer, and you are ready to start. Note: Git for Windows is a project run by volunteers, so if you want it to improve, volunteer! … If you want to download and install the complete source code of Git for Windows (including C compiler) to start hacking, you will need to install the full development system which is called msysGit. |
注釋:如果你需要使用Git工具在Windows下進資料列版本設定,你可以使用基於Windows的Git,這裡提供了msysGit的安裝下載。
我們選擇full安裝版本,http://code.google.com/p/msysgit/downloads/detail?name=msysGit-fullinstall-1.7.3.1-preview20101002.exe。
下載msysGit安裝包後安裝,在安裝過程中msysGit會自動的安裝或編譯基於Windows環境的Git。編譯Git需要點時間,安裝完後如下:
這就是Git的shell視窗,你可以在其中通過命名行操作下載得到Android的系統源碼,下面就以Lunacher——案頭——為例下載源碼。
二。下載Luancher源碼
Android系統源碼都在http://android.git.kernel.org/網址下,其中那個系統app都在platform/packages/apps結構下。
在剛才的Git的shell命名行視窗中輸入下面的命名:
git clone git://android.git.kernel.org/platform/packages/apps/Luancher2.git
你就可以在你的msysGit安裝目錄的git下(~\msysgit\msysgit\git)看到Luancher工程檔案夾了。
然後開啟~\msysgit\msysgit\git\Luancher2檔案夾,就可以看到Android的Luancher系統源碼工程了。
對於其他的app系統源碼的擷取方法和上述的Luancher相同,只是命名行後的參數不同。
git clone git://android.git.kernel.org/需下載源碼的app所在的位置。 |
三。啟動msysGit
有些朋友在關閉了msysGit命名行視窗後就找不到重新開啟的連結了,不用著急,你只需要在你安裝的msysGit路徑下雙擊執行msys.bat檔案即可。
所有的都大功告成了。