Androidのソースファイルを入手する方法

Androidのソースファイルは公式にGitで公開されています。
ダウンロードからビルドまでの手順もサイトに掲載されています。

Downloading the Source Tree

Gitで公開されているため、入手にはGitクライアントが必要です。

Gitをyumでインストールする方法
Windows版TortoiseGit Gitクライアント
Windows から Git を使う方法

ダウンロードされるファイルの容量は350MB程度です。(2011年6月現在)
しかしリポジトリから同期させるには完了まで2〜3時間かかります。

Linuxでソースコードをダウンロードする方法

WindowsOS上にLinuxをインストールする方法
CentOSのインストール

ホームディレクトリに/binディレクトリを作成し、パスを通します。

$ mkdir ~/bin
$ export PATH=$PATH:~bin

curlコマンドで、インターネットからrepo(スクリプトファイル)をダウンロードします。

$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17451  100 17451    0     0   7530      0  0:00:02  0:00:02 --:--:-- 25089

実行権をつけます。

$ chmod a+x ~/bin/repo

ダウンロード先フォルダを作成し、ディレクトリを移動します。

$ mkdir androidfroyo
$ cd androidfroyo

repoスクリプトファイルを以下の引数で実行しリポジトリの初期化します。

$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo init -u https://android.googlesource.com/platform/manifest
From git://android.git.kernel.org/platform/manifest
 * [new tag]         android-1.0 -> android-1.0
 * [new tag]         android-2.3.3_r1 -> android-2.3.3_r1

名前とメールアドレスを聞かれますが、ダウンロードだけならブランク(そのままEnter)でもダウンロードできます。

Your Name  [root]: 
Your Email [root@localhost.localdomain]:

Your identity is: root 
is this correct [y/n]?
is this correct [y/n]? y
Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white 
  bold     dim      ul       reverse 
Enable color display in this user account (y/n)? y

repo initialized in /home/hoge/androidfroyo

リポジトリと同期させて、ソースコードを取得します。

repo sync

関連記事

スポンサーリンク

INSERT関数 文字列中に文字列を挿入する

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る